/* ═══════════════════════════════════════════════════════════════════════════
   Портфоліо — стилі
   Дизайн-система «Industry» у темній темі: сталево-синій акцент на графітовому
   тлі, конденсовані заголовки, модульна сітка, blueprint-рамки з
   реєстраційними мітками «+» по кутах.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Токени ──────────────────────────────────────────────────────────────── */
:root {
  --color-bg: #0c0e10;
  --color-surface: #15181b;
  --color-text: #e8eaec;
  --color-accent: #7ea6cf;
  --color-divider: rgba(232, 234, 236, 0.16);

  --text-70: rgba(232, 234, 236, 0.72);
  --text-55: rgba(232, 234, 236, 0.58);
  --text-45: rgba(232, 234, 236, 0.45);

  --accent-soft: rgba(126, 166, 207, 0.12);
  --ok: #5fd08a;

  /* Barlow не має кирилиці — Fira Sans підхоплює її поглифово. */
  --font-heading: "Barlow Condensed", "Fira Sans Condensed", system-ui, sans-serif;
  --font-body: "Barlow", "Fira Sans", system-ui, sans-serif;

  --container: 1120px;
  --gutter: 24px;
  --section-pad: 72px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0;
}

p { margin: 0; }
img { display: block; max-width: 100%; }
svg { display: block; }

a { color: var(--color-accent); text-underline-offset: 3px; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 1px;
}
::selection { background: rgba(126, 166, 207, 0.3); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  padding: 10px 18px;
  background: var(--color-accent);
  color: var(--color-bg);
  font-family: var(--font-heading);
  text-decoration: none;
}
.skip-link:focus { left: 12px; }

/* ── Фонова сітка ────────────────────────────────────────────────────────── */
.grid-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 44px 44px;
}

.page { position: relative; z-index: 1; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ── Blueprint-рамка ─────────────────────────────────────────────────────── */
.blueprint {
  position: relative;
  border: 1px solid var(--color-divider);
  border-radius: 0;
}
.blueprint > .corner {
  position: absolute;
  width: 11px;
  height: 11px;
  color: rgba(232, 234, 236, 0.55);
}
.blueprint > .corner::before,
.blueprint > .corner::after { content: ""; position: absolute; background: currentColor; }
.blueprint > .corner::before { left: 5px; top: 0; width: 1px; height: 100%; }
.blueprint > .corner::after  { top: 5px; left: 0; width: 100%; height: 1px; }
.blueprint > .corner.tl { top: -6px; left: -6px; }
.blueprint > .corner.tr { top: -6px; right: -6px; }
.blueprint > .corner.bl { bottom: -6px; left: -6px; }
.blueprint > .corner.br { bottom: -6px; right: -6px; }

/* ── Кнопки ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--color-divider);
  border-radius: 0;
  background: transparent;
  color: var(--color-text);
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.btn-primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-bg);
}
.btn-primary:hover { background: #9ab9da; border-color: #9ab9da; }
.btn-primary:active { background: #6b93bc; border-color: #6b93bc; }
.btn-secondary:hover { background: rgba(232, 234, 236, 0.07); }
.btn-secondary:active { background: rgba(232, 234, 236, 0.14); }

/* ── Теги ────────────────────────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 11px;
  letter-spacing: 0.02em;
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
  border-radius: 0;
}

/* ── Шапка ───────────────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(12, 14, 16, 0.82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-divider);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 0;
}

.brand {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  text-decoration: none;
  color: var(--color-text);
  margin-right: auto;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 18px;
}
.brand-role {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
  font-weight: 500;
}

.nav { display: flex; gap: 22px; align-items: center; }
.nav a {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.01em;
  color: var(--color-text);
  text-decoration: none;
  opacity: 0.82;
  transition: opacity 0.16s ease, color 0.16s ease;
}
.nav a:hover { opacity: 1; color: var(--color-accent); }
.nav a.is-active { opacity: 1; color: var(--color-accent); }

/* Перемикач мови */
.seg {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--color-divider);
  flex: none;
}
.seg a {
  padding: 6px 12px;
  font-family: var(--font-body);
  font-size: 13px;
  text-decoration: none;
  color: var(--color-text);
  background: transparent;
  transition: background 0.16s ease;
}
.seg a:hover { background: var(--accent-soft); }
.seg a[aria-current="true"] {
  background: var(--color-accent);
  color: var(--color-bg);
}

/* Мобільне меню */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--color-divider);
  color: var(--color-text);
  cursor: pointer;
}
.menu-toggle:hover { background: rgba(232, 234, 236, 0.07); }

/* ── Секції ──────────────────────────────────────────────────────────────── */
.section {
  padding: var(--section-pad) 0;
  border-top: 1px solid var(--color-divider);
}
.section-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 36px;
}
.section-num {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 15px;
  color: var(--color-accent);
  letter-spacing: 0.1em;
}
.section-head h2 { font-size: 34px; }

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 48px;
  align-items: center;
  padding: 88px 0 72px;
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
.hero-copy { animation: riseIn 0.6s ease both; }
.hero-plate { animation: riseIn 0.6s ease 0.1s both; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-copy, .hero-plate { animation: none; }
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 22px;
}
.status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(95, 208, 138, 0.18);
}

.hero h1 {
  font-size: clamp(38px, 5.4vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 22px;
  max-width: 14ch;
}
.hero-lead {
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-70);
  max-width: 52ch;
  margin: 0 0 32px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-plate {
  padding: 28px;
  background: linear-gradient(160deg, rgba(126, 166, 207, 0.06), transparent 65%);
}
.monogram {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(72px, 9vw, 116px);
  line-height: 0.9;
  color: var(--color-accent);
  letter-spacing: -0.02em;
}
.plate-rule { height: 1px; background: var(--color-divider); margin: 22px 0; }
.spec-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 18px;
  margin: 0;
  font-size: 14px;
}
.spec-list dt {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-55);
  align-self: center;
}
.spec-list dd { margin: 0; color: var(--color-text); }

/* ── Про мене ────────────────────────────────────────────────────────────── */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 48px;
}
.about-text { font-size: 17px; line-height: 1.7; color: rgba(232, 234, 236, 0.82); }
.about-text p { margin: 0 0 18px; }
.about-text p:last-child { margin-bottom: 0; }

.facts {
  margin: 0;
  align-self: start;
  border-top: 1px solid var(--color-divider);
}
.facts .row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-divider);
}
.facts dt {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-55);
}
.facts dd { margin: 0; font-size: 14px; text-align: right; color: var(--color-text); }

/* ── Проєкти ─────────────────────────────────────────────────────────────── */
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
  gap: 26px;
}
.project {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px;
  background: transparent;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.project:hover { transform: translateY(-4px); border-color: var(--color-accent); }
.project-tag {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin: 0;
}
.project-name { font-size: 22px; line-height: 1.2; }

/* Уся картка клікабельна: невидимий шар кнопки лежить поверх неї,
   а справжні посилання підняті над цим шаром. */
.project-trigger {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
}
.project-trigger::after { content: ""; position: absolute; inset: 0; }
.project-trigger:focus-visible { outline: none; }
.project:has(.project-trigger:focus-visible) {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}
.project:hover .project-trigger { color: var(--color-accent); }

.project-desc { font-size: 14px; line-height: 1.62; opacity: 0.74; flex: 1; }
.stack { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 2px; }

.project-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--color-divider);
}
.project-links { display: flex; gap: 18px; position: relative; z-index: 1; }
.project-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 14px;
  color: var(--color-accent);
  text-decoration: none;
}
.project-links a:hover { text-decoration: underline; }

.project-more {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-55);
  transition: color 0.16s ease, gap 0.16s ease;
}
.project:hover .project-more { color: var(--color-accent); gap: 11px; }

/* ── Вікно з детальним описом проєкту ────────────────────────────────────── */
dialog:not([open]) { display: none; }
.modal {
  width: min(760px, calc(100vw - 32px));
  max-height: min(86vh, 900px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-text);
  overflow: visible;
}
.modal::backdrop {
  background: rgba(4, 5, 6, 0.74);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.modal-box {
  display: flex;
  flex-direction: column;
  max-height: min(86vh, 900px);
  background: var(--color-bg);
  background-image: linear-gradient(160deg, rgba(126, 166, 207, 0.05), transparent 45%);
}
/* Натяк, що вміст прокручується далі */
.modal-box::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: 1px;
  height: 34px;
  pointer-events: none;
  background: linear-gradient(to top, var(--color-bg), transparent);
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-divider);
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
}
.modal-close:hover { background: var(--color-surface); border-color: var(--color-accent); }

.modal-head {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px 68px 22px 28px;
  border-bottom: 1px solid var(--color-divider);
}
.modal-head h3 { font-size: 28px; line-height: 1.1; }

.modal-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 28px 28px;
  display: flex;
  flex-direction: column;
}
.modal-block { padding: 20px 0; border-bottom: 1px solid var(--color-divider); }
.modal-block:last-child { border-bottom: none; padding-bottom: 4px; }
.modal-block h4 {
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin: 0 0 14px;
}
.modal-block p {
  font-size: 15px;
  line-height: 1.68;
  color: rgba(232, 234, 236, 0.82);
  margin: 0 0 12px;
  max-width: 66ch;
}
.modal-block p:last-child { margin-bottom: 0; }

.modal-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.modal-list li {
  display: flex;
  gap: 11px;
  max-width: 66ch;
  font-size: 15px;
  line-height: 1.55;
  color: rgba(232, 234, 236, 0.82);
}
.modal-list li::before {
  content: "";
  width: 5px;
  height: 5px;
  margin-top: 9px;
  background: var(--color-accent);
  flex: none;
}

.modal-items { margin: 4px 0 0; display: flex; flex-direction: column; gap: 16px; }
.modal-items > div {
  display: grid;
  grid-template-columns: minmax(0, 190px) minmax(0, 1fr);
  gap: 8px 22px;
}
.modal-items dt {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.25;
  color: var(--color-text);
}
.modal-items dd {
  margin: 0;
  font-size: 14px;
  line-height: 1.62;
  color: rgba(232, 234, 236, 0.74);
}

body.modal-open { overflow: hidden; }

/* ── Навички ─────────────────────────────────────────────────────────────── */
/* Хайрлайн-сітка: рамки малюються через outline, тому «порожні» клітинки
   в останньому ряду не заливаються кольором роздільника. */
.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 1px;
}
.skill-group {
  background: var(--color-bg);
  padding: 24px;
  outline: 1px solid var(--color-divider);
}
.skill-group h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin: 0 0 16px;
}
.skill-items { display: flex; flex-direction: column; gap: 12px; }
.skill-items li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
}
.skill-items li::before {
  content: "";
  width: 5px;
  height: 5px;
  background: var(--color-accent);
  flex: none;
}
ul.skill-items { list-style: none; margin: 0; padding: 0; }

/* ── Освіта ──────────────────────────────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; }
.timeline-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 28px;
  padding: 24px 0;
  border-top: 1px solid var(--color-divider);
}
.timeline-period {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 15px;
  color: var(--color-accent);
  letter-spacing: 0.04em;
}
.timeline h3 { font-size: 21px; margin: 0 0 6px; }
.timeline-org { font-size: 15px; color: var(--text-70); }
.timeline-note { font-size: 14px; color: var(--text-55); margin-top: 6px; }

/* ── Сертифікати ─────────────────────────────────────────────────────────── */
.certs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 26px;
}
.cert {
  padding: 24px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.cert-icon { color: var(--color-accent); flex: none; margin-top: 2px; }
.cert h3 { font-size: 18px; line-height: 1.25; margin: 0 0 6px; }
.cert-meta { font-size: 14px; color: var(--text-55); }

/* ── Контакти ────────────────────────────────────────────────────────────── */
#contacts { padding-bottom: 40px; }
#contacts .section-head { margin-bottom: 20px; }
.contacts-lead {
  font-size: 19px;
  line-height: 1.6;
  color: rgba(232, 234, 236, 0.78);
  max-width: 46ch;
  margin: 0 0 34px;
}
.contacts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 1px;
  margin-bottom: 34px;
}
.contact {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--color-bg);
  outline: 1px solid var(--color-divider);
  padding: 20px 22px;
  text-decoration: none;
  color: var(--color-text);
  transition: background 0.16s ease;
  min-width: 0;
}
.contact:hover { background: var(--color-surface); }
.contact-icon { color: var(--color-accent); flex: none; }
.contact-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.contact-label {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-55);
}
.contact-value {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Підвал ──────────────────────────────────────────────────────────────── */
.footer {
  padding: 28px 0 48px;
  border-top: 1px solid var(--color-divider);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text-45);
}

/* ── Адаптив ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --section-pad: 56px; }
  .hero {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 56px 0;
  }
  .hero h1 { max-width: 18ch; }
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .timeline-row { grid-template-columns: 1fr; gap: 8px; }
}

@media (max-width: 760px) {
  .menu-toggle { display: inline-flex; }
  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 6px var(--gutter) 14px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-divider);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.55);
  }
  .nav[hidden] { display: none; }
  .nav a {
    padding: 12px 0;
    border-bottom: 1px solid var(--color-divider);
    font-size: 17px;
  }
  .nav a:last-child { border-bottom: none; }
}

@media (max-width: 700px) {
  .modal-items > div { grid-template-columns: 1fr; gap: 4px; }
  .modal-head { padding: 24px 62px 20px 22px; }
  .modal-body { padding: 6px 22px 24px; }
  .modal-head h3 { font-size: 24px; }
}

@media (max-width: 560px) {
  :root { --gutter: 18px; --section-pad: 48px; }
  .section-head h2 { font-size: 28px; }
  .hero-lead { font-size: 17px; }
  .contacts-lead { font-size: 17px; }
  .project { padding: 22px; }
  .hero-actions .btn { flex: 1 1 auto; }
  .facts dd { font-size: 13px; }
  .modal { width: 100vw; max-height: 92vh; }
  .modal-box { max-height: 92vh; }
}

/* ── Друк ────────────────────────────────────────────────────────────────── */
@media print {
  .grid-backdrop, .header, .seg, .menu-toggle, .hero-actions, .footer { display: none !important; }
  body { background: #fff; color: #111; }
  .section { border-color: #ccc; page-break-inside: avoid; }
  a { color: #111; text-decoration: none; }
}
