/* =========================================================
   ТЕМА: GTA VI / Vice City sunset (приглушена, не кислотна)
   Світла і темна теми перемикаються атрибутом data-theme на <html>.
   Шрифт: Roboto Mono, підключений у <head> файлу index.html.
   ========================================================= */

/* ===== Змінні: кольори, шрифт, розміри ===== */
:root {
  --font: "Roboto Mono", Georgia, "Times New Roman", serif;

  /* Світла тема: кремово-персиковий день */
  --bg: #fff4ee;          /* фон сторінки */
  --bg-alt: #fbe6dd;      /* фон альтернативних блоків (верх) */
  --bg-alt-2: #f3dcdc;    /* фон альтернативних блоків (низ) */
  --surface: #fff9f5;     /* картки */
  --ink: #3a2a3f;         /* основний текст: темна слива */
  --ink-soft: #735d79;    /* другорядний текст */
  --line: #ecd3c9;        /* лінії та рамки */
  --accent: #b9587a;      /* акцент: припилений рожевий */
  --accent-text: #a64862; /* акцент для тексту/посилань (кращий контраст) */
  --accent-ink: #ffffff;  /* текст на акценті */
  --stripe: rgba(58, 42, 63, .05); /* смужки на заглушках фото */

  /* Сансет-градієнти: лаванда -> рожевий -> помаранчевий */
  --sunset: linear-gradient(90deg, #8f6aa3 0%, #c4708a 50%, #e0976a 100%);
  --sunset-btn: linear-gradient(90deg, #8f6aa3 0%, #b0506b 100%);
  --sun-1: #e8b9c4;       /* сонце: верх */
  --sun-2: #eca98f;       /* сонце: середина */
  --sun-3: #f2c9a4;       /* сонце: низ */
  --glow: rgba(185, 88, 122, .28);  /* тінь-світіння карток */

  /* Заставка */
  --splash-a: #d9c9e0;
  --splash-b: #f0c4c8;
  --splash-c: #f7dcc0;

  --header-h: 64px;
  --gap: clamp(16px, 3vw, 28px);
  --pad-x: clamp(20px, 5vw, 48px);
  --section-y: clamp(56px, 10vw, 112px);
  --max-w: 1120px;
}

/* ===== Темна тема: Vice City вночі ===== */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1f1824;
  --bg-alt: #261d2b;
  --bg-alt-2: #2d2133;
  --surface: #2a2030;
  --ink: #efe3ea;
  --ink-soft: #a894a5;
  --line: #3a2d40;
  --accent: #d98a9f;
  --accent-text: #d98a9f;
  --accent-ink: #1f1824;
  --stripe: rgba(239, 227, 234, .05);

  --sunset: linear-gradient(90deg, #a58bb8 0%, #d98a9f 50%, #d9a07a 100%);
  --sunset-btn: linear-gradient(90deg, #a58bb8 0%, #d98a9f 55%, #d9a07a 100%);
  --sun-1: #b9677d;
  --sun-2: #c9806f;
  --sun-3: #d9a07a;
  --glow: rgba(217, 138, 159, .30);

  --splash-a: #1a1322;
  --splash-b: #3b2540;
  --splash-c: #5a3b45;
}

:root[data-theme="light"] { color-scheme: light; }

/* ===== База ===== */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 8px);
  -webkit-text-size-adjust: 100%;
}

body {
  transition: background-color .25s ease, color .25s ease;
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
}

body.menu-open { overflow: hidden; }

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

a { color: inherit; }

ul { margin: 0; padding: 0; list-style: none; }

h1, h2, h3, p { margin: 0; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}



.container {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

/* ===== Шапка ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-left: -9px;      /* щоб іконка вирівнювалась по краю контенту */
  text-decoration: none;
  transition: color .2s ease;
}

.logo:hover { color: var(--accent); }

/* Логотип + кнопка теми поруч */
.header__left {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== Кнопка зміни теми ===== */
.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--ink);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color .2s ease;
}

.theme-btn:hover { color: var(--accent); }

.theme-btn__sun { display: none; }

:root[data-theme="dark"] .theme-btn__moon { display: none; }
:root[data-theme="dark"] .theme-btn__sun { display: block; }

/* ===== Меню: мобільна версія (за замовчуванням) ===== */
.menu-btn {
  position: relative;
  z-index: 60;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  padding: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--ink);
}

.menu-btn__bar {
  display: block;
  width: 24px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform .25s ease, opacity .2s ease;
}

.menu-open .menu-btn__bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-open .menu-btn__bar:nth-child(2) { opacity: 0; }
.menu-open .menu-btn__bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* Випадаюча панель на весь екран під шапкою */
.nav {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  z-index: 55;
  padding: 24px var(--pad-x);
  background: var(--bg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px);
  transition: opacity .25s ease, transform .25s ease, visibility 0s linear .25s;
}

.menu-open .nav {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .25s ease, transform .25s ease, visibility 0s;
}

.nav__list a {
  display: block;
  padding: 18px 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.nav__list a:hover { color: var(--accent); }

/* ===== Меню: десктоп ===== */
@media (min-width: 760px) {
  .menu-btn { display: none; }

  .nav {
    position: static;
    padding: 0;
    background: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
  }

  .nav__list {
    display: flex;
    gap: 32px;
  }

  .nav__list a {
    padding: 6px 0;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0;
    border-bottom: 2px solid transparent;
  }

  .nav__list a:hover {
    color: var(--ink);
    border-bottom-color: var(--accent);
  }
}

/* ===== Кнопки ===== */
.btn {
  display: inline-block;
  padding: 13px 22px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  background: transparent;
  border: 2px solid var(--ink);
  border-radius: 4px;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

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

.btn--primary {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.btn--primary:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

/* ===== Головний екран ===== */
.hero {
  padding-block: clamp(64px, 14vw, 160px) clamp(56px, 10vw, 112px);
}

.hero__title {
  max-width: 16ch;
  font-size: clamp(2.5rem, 8.5vw, 6rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 700;
}

.hero__text {
  max-width: 52ch;
  margin-top: clamp(20px, 3vw, 32px);
  font-size: clamp(1.0625rem, 2.2vw, 1.25rem);
  color: var(--ink-soft);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: clamp(28px, 4vw, 40px);
}

/* ===== Секції ===== */
.section { padding-block: var(--section-y); }

/* "Website" іде одразу після "Projects", тому верхній відступ не дублюємо */
#projects + #web { padding-top: 0; }

.section--alt {
  background: var(--bg-alt);
}

.section__title {
  margin-bottom: clamp(15px, 5vw, 48px);
  font-size: clamp(1.75rem, 4.5vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

/* ===== Проєкти ===== */
.projects {
  display: grid;
  grid-template-columns: 1fr;
  gap: calc(var(--gap) * 1.5) var(--gap);
}

@media (min-width: 620px) {
  .projects { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 960px) {
  .projects { grid-template-columns: repeat(3, 1fr); }
}

.card__link {
  display: block;
  text-decoration: none;
}

.card__media {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  margin-bottom: 16px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: .9375rem;
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, var(--stripe) 14px 15px),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  transition: border-color .2s ease;
}

/* Для справжніх фото: <img> всередині .card__media */
.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__title {
  font-size: 1.25rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  transition: text-decoration-color .2s ease;
}

.card__text {
  margin-top: 8px;
  color: var(--ink-soft);
}

.card__link:hover .card__media { border-color: var(--accent); }
.card__link:hover .card__title { text-decoration-color: var(--accent); }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tags li {
  padding: 2px 10px;
  font-size: .875rem;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
}

/* ===== Файли ===== */
.about__body {
  max-width: 68ch;
}

.about__body p + p { margin-top: 1em; }

.facts {
  margin-top: 32px;
  border-top: 1px solid var(--line);
}

.facts li {
  display: grid;
  grid-template-columns: 14.5rem 1fr;
  gap: 16px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}

.facts strong { font-weight: 700; }

.facts a {
  justify-self: start;
  color: var(--accent);
  text-underline-offset: 3px;
}

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

/* Згорнутий список: видно лише перші 3 пункти (LIMIT + 1 = 4) */
.facts--collapsible.is-collapsed li:nth-child(n+4) {
  display: none;
}

.more-btn {
  margin-top: 14px;
  padding: 0;
  font: inherit;
  font-size: .9375rem;
  color: var(--ink-soft);
  background: none;
  border: 0;
  border-bottom: 1px dashed currentColor;
  cursor: pointer;
  transition: color .2s ease;
}

.more-btn:hover,
.more-btn:focus-visible { color: var(--accent); }

/* На вузьких екранах назва зверху, посилання під нею */
@media (max-width: 480px) {
  .facts li {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* ===== Контакти ===== */
.contact__text {
  max-width: 48ch;
  color: var(--ink-soft);
}

.contact__mail {
  display: inline-block;
  margin-top: 16px;
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
  word-break: break-word;
}

.contact__mail:hover { color: var(--accent); }

.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-top: 28px;
}

.socials a { color: var(--ink-soft); }
.socials a:hover { color: var(--accent); }

/* ===== Підвал ===== */
.footer {
  padding-block: 28px;
  font-size: .9375rem;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
}

/* ===== Менше руху, якщо так налаштовано в системі ===== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: .01ms !important;
  }
}

/* =========================================================
   ЗАСТАВКА ПРИ ВХОДІ
   Логотип + milanets.com показуються, поки сторінка вантажиться
   (мінімум ~2с). Коли все завантажено, заставка зникає, а сайт
   повільно проявляється. Час змінюється тут і в скрипті внизу index.html.
   Налаштування системи "зменшити рух" на цю анімацію не впливає.
   ========================================================= */
.splash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--ink);
  opacity: 1;
  visibility: visible;
  transition: opacity .9s ease, visibility 0s linear 0s;
}

html:not(.splash-on) .splash {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .9s ease, visibility 0s linear .9s;
}

.splash__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.splash__logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  opacity: 0;
  animation: splash-logo .9s ease .15s forwards;
}

.splash__text {
  font-size: 1rem;
  letter-spacing: .06em;
  opacity: 0;
  animation: splash-fade .9s ease .6s forwards;
}

@keyframes splash-logo {
  from { opacity: 0; transform: scale(.85); }
  to   { opacity: 1; transform: none; }
}

@keyframes splash-fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* Поки заставка активна, сайт прихований; потім повільно проявляється.
   Для шапки тільки opacity: transform ламає fixed-меню всередині неї. */
.splash-on .header,
.splash-on main,
.splash-on .footer { opacity: 0; }

.header { animation: site-fade 2s ease .5s backwards; }

main,
.footer { animation: site-rise 2s ease .5s backwards; }

@keyframes site-fade {
  from { opacity: 0; }
}

@keyframes site-rise {
  from { opacity: 0; transform: translateY(14px); }
}

/* Заставка ігнорує "зменшити рух": повертаємо їй плавне зникнення
   (глобальне правило вище скорочує всі transition до .01ms) */
@media (prefers-reduced-motion: reduce) {
  .splash { transition-duration: .9s, 0s !important; }
}


/* =========================================================
   GTA VI: оформлення поверх базових стилів
   Усе, що пов'язано зі стилем, зібрано тут, щоб легко
   вимкнути або підправити (видали блок: сайт стане звичайним).
   ========================================================= */

::selection { background: var(--accent); color: var(--accent-ink); }

/* Сансет-смужка під заголовком секції */
.section__title::after {
  content: "";
  display: block;
  width: 72px;
  height: 6px;
  margin-top: 14px;
  border-radius: 999px;
  background: var(--sunset);
}

/* --- Шапка: градієнтна лінія знизу --- */
.header { border-bottom-color: transparent; }

.header::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: var(--sunset);
  opacity: .85;
}

/* --- Кнопки --- */
.btn {
  border-radius: 999px;
  padding: 13px 26px;
}

.btn--primary {
  background: var(--sunset-btn);
  border-color: transparent;
}

.btn--primary:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

/* --- Головний екран: сонце Vice City --- */
.hero {
  position: relative;
  overflow: hidden;
}

.hero > .container { position: relative; z-index: 1; }

.hero::before {
  content: "";
  position: absolute;
  top: 50%;
  right: var(--pad-x);
  width: clamp(200px, 36vw, 440px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--sun-1) 0%, var(--sun-2) 55%, var(--sun-3) 100%);
  transform: translateY(-50%);
  opacity: .9;
  pointer-events: none;
  /* верхня половина суцільна, нижня: горизонтальні смуги */
  -webkit-mask-image:
    linear-gradient(#000, #000),
    repeating-linear-gradient(to bottom, #000 0 11px, transparent 11px 16px);
  -webkit-mask-size: 100% 52%, 100% 48%;
  -webkit-mask-position: top, bottom;
  -webkit-mask-repeat: no-repeat;
  mask-image:
    linear-gradient(#000, #000),
    repeating-linear-gradient(to bottom, #000 0 11px, transparent 11px 16px);
  mask-size: 100% 52%, 100% 48%;
  mask-position: top, bottom;
  mask-repeat: no-repeat;
}

/* На телефоні сонце стає фоном за текстом */
@media (max-width: 620px) {
  .hero::before {
    top: 24px;
    right: -70px;
    transform: none;
    opacity: .4;
  }
}

/* --- Альтернативні секції: м'який градієнт --- */
.section--alt {
  background: linear-gradient(180deg, var(--bg-alt) 0%, var(--bg-alt-2) 100%);
}

/* --- Картки --- */
.card__media {
  transition: border-color .2s ease, transform .25s ease, box-shadow .25s ease;
}

.card__link:hover .card__media {
  transform: translateY(-4px);
  box-shadow: 0 14px 32px -14px var(--glow);
}

/* --- Посилання та другорядні елементи --- */
.facts a { color: var(--accent-text); }
.facts a:hover { color: var(--ink); }
.more-btn:hover,
.more-btn:focus-visible { color: var(--accent-text); }
.socials a:hover,
.contact__mail:hover { color: var(--accent-text); }

/* Пошта: градієнтне підкреслення замість звичайного */
.contact__mail {
  text-decoration: none;
  padding-bottom: 8px;
  background: var(--sunset) 0 100% / 100% 4px no-repeat;
}

/* --- Підвал: градієнтна лінія --- */
.footer {
  border-top: 2px solid transparent;
  border-image: var(--sunset) 1;
}

/* --- Заставка: сансет-градієнт --- */
.splash {
  background: linear-gradient(180deg, var(--splash-a) 0%, var(--splash-b) 55%, var(--splash-c) 100%);
}
