/* =========================================================
   ШРИФТ
   Libre Caslon Condensed підключений у <head> файлу index.html
   (тег <link> від Google Fonts), тому тут @import не потрібен.
   Назва шрифту стоїть ПЕРШОЮ у змінній --font нижче.
   ========================================================= */

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

  --bg: #ffffff;          /* фон сторінки */
  --bg-alt: #e4e8ec;      /* фон альтернативних блоків */
  --surface: #ffffff;     /* картки */
  --ink: #18222d;         /* основний текст */
  --ink-soft: #55616e;    /* другорядний текст */
  --line: #cdd4db;        /* лінії та рамки */
  --accent: #9b1fd8;      /* акцент: кнопки, посилання */
  --accent-ink: #ffffff;  /* текст на акценті */
  --stripe: rgba(24, 34, 45, .05); /* смужки на заглушках фото */

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

/* ===== Темна тема ===== */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12161c;
  --bg-alt: #1b212a;
  --surface: #171c23;
  --ink: #e8ecf0;
  --ink-soft: #9aa6b2;
  --line: #2c3541;
  --accent: #c168ff;
  --accent-ink: #12161c;
  --stripe: rgba(232, 236, 240, .05);
}

: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;
  }
}
