/* Maxat Khaimuldin — сайт-портфолио
   Значения взяты из макета в Figma: десктоп 1440 (контент 1240), мобилка 375 (контент 335).
   Граница макетов — 1024 px. */

/* Шрифты лежат на сайте (латиница + кириллица), чтобы не зависеть от сторонних серверов. Лицензия OFL. */
@font-face {
  font-family: "Geologica";
  src: url("../fonts/geologica.woff2") format("woff2");
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #0c0407;
  --muted: #8c8c8c;
  --surface: #f2f2f2;
  --line: #e5e5e5;
  --bg: #ffffff;
  --on-dark: #f2f2f2;

  --spots: #ff5100;
  --jenos: #b07040;
  --heros: #7c4df0;

  --f-head: "Geologica", system-ui, sans-serif;
  --f-text: "Inter", system-ui, sans-serif;

  --radius: 12px;
  --container: 1240px;
  --gutter: 100px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-text);
  font-size: 14px;
  line-height: 22px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.on-dark :focus-visible { outline-color: var(--on-dark); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.container {
  width: min(var(--container), calc(100% - 2 * min(var(--gutter), 6vw)));
  margin-inline: auto;
}

/* ---------- Шапка ---------- */
.header { padding-top: 24px; }
.header__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  min-height: 44px;
}
.logo {
  flex: 0 0 286px;
  font-family: var(--f-head);
  font-weight: 600;
  font-size: 24px;
  line-height: 32px;
  text-decoration: none;
  white-space: nowrap;
}
.nav { display: flex; gap: 40px; justify-content: center; flex: 0 0 392px; }
.nav a {
  font-weight: 500;
  font-size: 14px;
  line-height: 20px;
  text-decoration: none;
  text-decoration-thickness: 2px;
  text-underline-offset: 8px;
  text-decoration-skip-ink: none;
}
.nav a[aria-current="page"] { text-decoration-line: underline; }
@media (hover: hover) { .nav a:hover { text-decoration-line: underline; } }
.nav a.nav__cv { font-weight: 600; }
.header__actions { flex: 0 0 286px; display: flex; justify-content: flex-end; }
.burger, .menu { display: none; }

/* ---------- «Связаться»: кнопка с выпадающим списком ---------- */
.contact { position: relative; width: max-content; }
.contact__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
}
.contact__arrow { width: 7px; height: 6px; transform: rotate(180deg); transition: transform .2s ease; flex: none; }
.contact__list {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: -12px;
  padding: 12px 0 8px;
  border-radius: 0 0 var(--radius) var(--radius);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
  z-index: 20;
}
.contact__list a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 10px 20px 10px 16px;
  font-weight: 600;
  font-size: 14px;
  line-height: 20px;
  text-decoration: none;
}
@media (hover: hover) { .contact__list a:hover { text-decoration: underline; text-underline-offset: 4px; } }
.contact__list svg { width: 20px; height: 20px; flex: none; }
.contact.is-open .contact__list { opacity: 1; visibility: visible; transform: none; }
.contact.is-open .contact__arrow { transform: none; }
.contact.is-open .contact__btn { border-radius: var(--radius) var(--radius) 0 0; }
@media (hover: hover) and (min-width: 1024px) {
  .contact:hover .contact__list, .contact:has(:focus-visible) .contact__list { opacity: 1; visibility: visible; transform: none; }
  .contact:hover .contact__arrow, .contact:has(:focus-visible) .contact__arrow { transform: none; }
  .contact:hover .contact__btn, .contact:has(:focus-visible) .contact__btn { border-radius: var(--radius) var(--radius) 0 0; }
}
.contact--dark .contact__btn, .contact--dark .contact__list { background: var(--ink); color: #fff; }
.contact--dark svg path { stroke: #fff; }
.contact--dark .contact__arrow path { fill: #fff; }
.contact--light .contact__btn, .contact--light .contact__list { background: #fff; color: var(--ink); }
.contact--light .contact__list svg path { stroke: var(--ink); }
.contact--footer .contact__list a { padding-left: 20px; }
.contact--light .contact__arrow path { fill: var(--ink); }

/* ---------- Первый экран ---------- */
.hero { padding-top: 64px; display: flex; flex-direction: column; gap: 24px; }
.hero__top { display: flex; justify-content: space-between; align-items: flex-start; }
.hero__photo-col { display: flex; flex-direction: column; gap: 16px; width: 286px; }
.hero__hello { font-weight: 500; font-size: 20px; line-height: 28px; }
.hero__photo { width: 286px; height: 286px; border-radius: var(--radius); object-fit: cover; background: var(--surface); }
.hero__desc { max-width: 392px; padding-block: 40px; } /* ширина по тексту — правый край совпадает с кнопкой */
.hero__desc--mobile { display: none; }
.hero__name { display: flex; flex-direction: column; gap: 8px; }
.hero__name h1 { font-family: var(--f-head); font-weight: 500; font-size: clamp(56px, 6.11vw, 88px); line-height: 1.0909; }
.hero__role { font-family: var(--f-head); font-weight: 500; font-size: 40px; line-height: 48px; }

/* ---------- Разделы главной ---------- */
.section { padding-top: 120px; display: flex; flex-direction: column; gap: 40px; }
.section__head { display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; }
.section__title {
  font-family: var(--f-head);
  font-weight: 500;
  font-size: clamp(56px, 6.11vw, 88px);
  line-height: 1.0909;
  text-align: center;
}
.section__lead { max-width: 604px; }

/* Карточки кейсов */
.cases { display: flex; flex-direction: column; gap: 64px; }
.case-card { display: flex; flex-direction: column; gap: 16px; text-decoration: none; }
.cover {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  aspect-ratio: 1240 / 465;
  container-type: inline-size;
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
/* Лёгкое приближение обложки при наведении. Чтобы экраны не мылились, на десктоп всегда
   отдаётся картинка 2480: при увеличении браузер её уменьшает, а не растягивает. */
@media (hover: hover) {
  .cover img { transition: transform .4s ease; }
  .case-card:hover .cover img, .case-card.is-hover .cover img { transform: scale(1.015); }
}
@media (prefers-reduced-motion: reduce) { .cover img { transition: none; } }
.cover__title {
  position: absolute;
  left: 40px;
  top: 40px;
  color: #fff;
  font-family: var(--f-head);
  font-weight: 700;
  font-size: 40px;
  line-height: 48px;
}
/* Название уменьшается вместе с обложкой, чтобы в узком окне не наезжать на экраны.
   При ширине обложки 1240 (макет) — ровно 40 px и отступы 40. */
@supports (width: 1cqw) {
  .cover__title {
    left: min(40px, 100cqw * 40 / 1240);
    top: min(40px, 100cqw * 40 / 1240);
    font-size: min(40px, 100cqw * 40 / 1240);
    line-height: 1.2;
  }
}
.cover--spots { background: var(--spots); }
.cover--jenos { background: var(--jenos); }
.cover--heros { background: var(--heros); }
.case-card__caption { display: flex; flex-direction: column; gap: 12px; }
.case-card__title { font-weight: 500; font-size: 20px; line-height: 28px; }
@media (hover: hover) {
  .case-card:hover .case-card__title, .case-card.is-hover .case-card__title { text-decoration: underline; text-underline-offset: 4px; }
}
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  line-height: 16px;
}

/* Скиллы */
.skills { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; }
.skill { display: flex; flex-direction: column; gap: 24px; }
.skill__icon { width: 52px; height: 52px; border-radius: var(--radius); background: var(--surface); display: grid; place-items: center; }
.skill__icon svg { width: 20px; height: 20px; }
.skill__text { display: flex; flex-direction: column; gap: 12px; }
.skill__title { font-family: var(--f-head); font-weight: 600; font-size: 24px; line-height: 32px; min-height: 64px; }

/* Опыт */
.about { max-width: 604px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.groups { display: flex; flex-direction: column; gap: 40px; }
.group { display: flex; flex-direction: column; gap: 24px; }
.group__title { font-family: var(--f-head); font-weight: 500; font-size: 40px; line-height: 48px; }
.places { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; }
.place { display: flex; flex-direction: column; gap: 16px; }
.place__head { display: flex; flex-direction: column; gap: 8px; }
.place__name { font-family: var(--f-head); font-weight: 600; font-size: 24px; line-height: 32px; }
.place__meta { display: flex; flex-direction: column; gap: 4px; }
.place__role { font-weight: 600; line-height: 20px; }
.place__dates { font-size: 12px; line-height: 16px; color: var(--muted); }
.place__desc { display: flex; flex-direction: column; gap: 22px; }
.btn-row { display: flex; justify-content: center; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 12px 20px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  line-height: 20px;
  text-decoration: none;
}
.btn:hover { background: #2a2226; }
.btn__arrow { width: 7px; height: 6px; transform: rotate(90deg); }
.btn__arrow path { fill: #fff; }

/* ---------- Футер ---------- */
.page-main { padding-bottom: 120px; }
.footer { background: var(--ink); color: var(--on-dark); padding: 120px 0 40px; }
.footer__inner { display: flex; flex-direction: column; gap: 120px; }
.footer__top { display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; }
.footer__title { font-family: var(--f-head); font-weight: 500; font-size: clamp(56px, 6.11vw, 88px); line-height: 1.0909; color: var(--on-dark); }
.footer__text { max-width: 604px; }
.footer__links { display: flex; justify-content: space-between; }
.footer__col { display: flex; gap: 40px; }
.footer__col a { text-decoration: none; text-decoration-thickness: 2px; text-underline-offset: 8px; text-decoration-skip-ink: none; }
@media (hover: hover) { .footer__col a:hover { text-decoration-line: underline; } }
.bottom { padding: 16px 0; text-align: center; font-size: 12px; line-height: 16px; color: var(--muted); }

/* ======================================================
   Мобилка (< 1024): макет 375, поля 20
   ====================================================== */
@media (max-width: 1023px) {
  .container { width: min(600px, calc(100% - 40px)); }
  body { font-size: 16px; line-height: 24px; }

  /* шапка + меню */
  .header { padding-top: 0; position: relative; z-index: 30; background: var(--bg); }
  .header__row { min-height: 80px; padding-block: 16px; gap: 8px; }
  .logo { flex: 1 1 auto; font-weight: 500; }
  .nav, .header__actions { display: none; }
  .burger {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    background: var(--ink);
    flex: none;
  }
  .burger__icon { position: relative; width: 18px; height: 14px; }
  .burger__icon span {
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    background: #fff;
    transition: transform .2s ease, opacity .2s ease, top .2s ease;
  }
  .burger__icon span:nth-child(1) { top: 0; }
  .burger__icon span:nth-child(2) { top: 6px; }
  .burger__icon span:nth-child(3) { top: 12px; }
  .menu-open .burger__icon span:nth-child(1) { top: 6px; transform: rotate(45deg); }
  .menu-open .burger__icon span:nth-child(2) { opacity: 0; }
  .menu-open .burger__icon span:nth-child(3) { top: 6px; transform: rotate(-45deg); }

  .menu {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--surface);
    padding: 8px 0 16px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
  }
  .menu-open .menu { opacity: 1; visibility: visible; transform: none; }
  .menu a { display: block; padding: 12px 0; text-decoration: none; }
  .menu a.menu__cv { font-weight: 500; }
  .menu hr { border: 0; height: 1px; background: var(--line); margin: 12px 0; }

  /* первый экран */
  .hero { padding-top: 16px; gap: 24px; text-align: center; }
  .hero__top { flex-direction: column; align-items: center; gap: 24px; }
  .hero__photo-col { width: 100%; align-items: center; }
  .hero__hello { font-family: var(--f-head); font-size: 24px; line-height: 32px; }
  .hero__photo { width: 295px; height: 295px; }
  .hero__top .hero__desc { display: none; }
  .hero__desc--mobile { display: block; width: auto; max-width: none; padding: 0; font-size: 16px; line-height: 24px; text-wrap: balance; }
  .hero__name { gap: 4px; }
  .hero__name h1 { font-size: 28px; line-height: 36px; }
  .hero__role { font-size: 20px; line-height: 28px; }

  /* разделы */
  .section { padding-top: 64px; gap: 24px; }
  .section__head { gap: 16px; }
  .section__title { font-size: 28px; line-height: 36px; }

  .cases { gap: 40px; }
  .cover { aspect-ratio: 335 / 188; }
  .cover__title { left: 20px; top: 20px; font-weight: 500; font-size: 24px; line-height: 32px; }
  /* при ширине обложки 335 (макет) — 24 px и отступы 20; на планшете не крупнее 32 */
  @supports (width: 1cqw) {
    .cover__title { left: min(24px, 100cqw * 20 / 335); top: min(24px, 100cqw * 20 / 335); font-size: min(32px, 100cqw * 24 / 335); line-height: 1.3333; }
  }
  .case-card__title { font-family: var(--f-head); font-size: 20px; line-height: 28px; }
  .tag { font-size: 16px; line-height: 24px; }

  .skills { grid-template-columns: 1fr; gap: 40px; }
  .skill { gap: 16px; }
  .skill__title { min-height: 0; font-weight: 500; font-size: 20px; line-height: 28px; }

  .places { grid-template-columns: 1fr; gap: 40px; }
  .place__name { font-weight: 500; font-size: 20px; line-height: 28px; }
  .place__role { font-weight: 500; line-height: 24px; }
  .place__desc { gap: 24px; }
  .group__title { font-size: 24px; line-height: 32px; }
  .btn-row .btn { width: 100%; height: 48px; padding: 12px 20px; justify-content: space-between; font-weight: 500; font-size: 16px; line-height: 24px; }

  .page-main { padding-bottom: 64px; }

  /* футер */
  .footer { padding: 64px 0 32px; }
  .footer__inner { gap: 48px; }
  .footer__title { font-size: 28px; line-height: 36px; }
  .contact--footer { width: 100%; }
  .contact--footer .contact__btn { width: 100%; height: 48px; padding: 12px 20px; font-weight: 500; font-size: 16px; line-height: 24px; }
  .contact--footer .contact__list { position: static; margin-top: 0; padding-top: 0; border-radius: 0 0 var(--radius) var(--radius); display: none; opacity: 1; visibility: visible; transform: none; }
  .contact--footer.is-open .contact__list { display: block; }
  .contact--footer .contact__list a { min-height: 48px; padding: 12px 20px; font-weight: 500; font-size: 16px; line-height: 24px; }
  .footer__links { justify-content: center; gap: 48px; }
  .footer__col { flex-direction: column; gap: 0; }
  .footer__col a { display: block; padding: 12px 0; }
}
