/* =========================================================
   PORTFOLIO PAGE
   ========================================================= */

.wrapper-portfolio {
  max-width: 1110px;
}

.portfolio-block {
  margin-bottom: 28px;
}

.hero-small {
  padding: 60px 20px;
  margin-bottom: 34px;
}

.hero-small .hero-content {
  max-width: 980px;
}

.hero-small h1 {
  margin-bottom: 14px;
}

.hero-small p {
  max-width: 860px;
  font-size: 18px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.cta-button-secondary {
  background: transparent;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.34);
  box-shadow: none;
}

.cta-button-secondary:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff;
}

.projects-note {
  margin: 0;
  font-size: 16px;
  line-height: 1.8;
  color: var(--light-text);
}

.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.project-item {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 26px;
  box-shadow: var(--shadow);
}

.project-item-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 320px;
  gap: 28px;
  align-items: stretch;
}

.project-main {
  min-width: 0;
}

.project-head {
  margin-bottom: 14px;
}

.project-name {
  margin: 0 0 12px;
  font-size: 22px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--dark-text);
}

.project-type {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.10);
  color: var(--primary);
  font-size: 12px;
  line-height: 1;
  font-weight: 600;
}

.project-summary {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.6;
  font-weight: 600;
  color: var(--dark-text);
}

.project-description {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.85;
  color: var(--light-text);
}

.project-meta {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 14px;
  align-items: start;
}

.project-meta-label {
  font-size: 13px;
  line-height: 1.5;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dark-text);
}

.project-meta-value {
  font-size: 14px;
  line-height: 1.7;
  color: var(--light-text);
}

.project-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
  min-width: 0;
}

.project-thumb-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.project-thumb-frame,
.project-thumb-empty {
  width: 100%;
  min-height: 220px;
  border-radius: 16px;
  box-sizing: border-box;
}

.project-thumb-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border: 1px solid var(--border-color);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.04)),
    var(--light-bg);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.project-thumb-button:hover .project-thumb-frame {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.10);
  border-color: rgba(37, 99, 235, 0.35);
}

.project-thumb {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: 260px;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  background: transparent;
}

.project-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  color: var(--light-text);
  background: var(--light-bg);
  border: 1px dashed var(--border-color);
}

.project-actions {
  margin-top: auto;
  width: 100%;
}

.project-link,
.project-link-disabled {
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 12px;
  box-sizing: border-box;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: 0.2s;
}

.project-side .project-link,
.project-side .project-link-disabled {
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.project-link {
  background: var(--primary);
  color: #ffffff;
}

.project-link:hover {
  background: var(--primary-dark);
}

.project-link-disabled {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: transparent;
  color: var(--light-text);
  border: 1px dashed var(--border-color);
  cursor: default;
  text-align: center;
}

.project-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.project-mini-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 22px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: var(--light-bg);
}

.project-mini-title {
  margin: 0 0 10px;
  font-size: 17px;
  line-height: 1.45;
  font-weight: 700;
  color: var(--dark-text);
}

.project-mini-text {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--light-text);
}

.project-mini-card .project-link,
.project-mini-card .project-link-disabled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  width: auto;
  min-width: 190px;
  max-width: 230px;
  align-self: flex-start;
  text-align: center;
}

/* =========================================================
   MODAL
   ========================================================= */

body.modal-open {
  overflow: hidden;
}

.image-modal[hidden] {
  display: none;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  padding: 8px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
}

.image-modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 8, 18, 0.82);
  backdrop-filter: blur(6px);
}

.image-modal__dialog {
  position: relative;
  z-index: 1;
  display: inline-flex;
  flex-direction: column;
  width: fit-content;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  margin: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.image-modal__header {
  padding: 16px 64px 12px 20px;
}

.image-modal__title {
  font-size: 16px;
  line-height: 1.4;
  font-weight: 600;
  color: #e5e7eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.image-modal__close:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: scale(1.04);
}

.image-modal__body {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  overflow: auto;
}

.image-modal__img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 120px);
  border-radius: 12px;
  background: #0b1220;
}

/* =========================================================
   UP
   ========================================================= */

.scroll-top-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;

  width: 44px;
  height: 44px;
  border-radius: 10px;

  background: var(--primary);
  color: #fff;
  border: none;

  display: flex;
  align-items: center;
  justify-content: center;

  box-shadow: var(--shadow-lg);
  cursor: pointer;

  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);

  transition: 0.25s;
  z-index: 200;
}

.scroll-top-btn:hover {
  background: var(--primary-dark);
}

.scroll-top-btn.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}


/* =========================================================
   DARK
   ========================================================= */

html[data-theme='dark'] .project-item {
  background: #161b22;
  border-color: #232a35;
}

html[data-theme='dark'] .project-name,
html[data-theme='dark'] .project-summary,
html[data-theme='dark'] .project-meta-label,
html[data-theme='dark'] .project-mini-title {
  color: #e6edf3;
}

html[data-theme='dark'] .project-type {
  background: rgba(140, 183, 255, 0.14);
  color: var(--dark-accent);
}

html[data-theme='dark'] .project-mini-card {
  background: #11161f;
  border-color: #1e242d;
}

html[data-theme='dark'] .project-link {
  background: #1e2a3b;
  color: var(--dark-accent);
  border: 1px solid rgba(140, 183, 255, 0.25);
}

html[data-theme='dark'] .project-link:hover {
  background: #2b3548;
}

html[data-theme='dark'] .project-link-disabled {
  color: #9da7b3;
  border-color: #30363d;
}

html[data-theme='dark'] .project-thumb-frame,
html[data-theme='dark'] .project-thumb-empty {
  background: #0f131a;
  border-color: #30363d;
}

html[data-theme='dark'] .project-thumb-button:hover .project-thumb-frame {
  border-color: rgba(140, 183, 255, 0.35);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 980px) {
  .project-item-grid {
    grid-template-columns: 1fr;
  }

  .project-side {
    order: -1;
  }

  .project-thumb-frame,
  .project-thumb-empty {
    min-height: 240px;
  }

  .project-thumb {
    max-height: 320px;
  }
}

@media (max-width: 768px) {
  .hero-small {
    padding: 42px 14px;
    margin-bottom: 22px;
  }

  .hero-small p {
    font-size: 16px;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .cta-button {
    width: 100%;
  }

  .wrapper-portfolio {
    width: 100%;
    max-width: none;
    padding-left: 8px;
    padding-right: 8px;
  }

  .portfolio-block {
    margin-bottom: 16px;
  }

  .projects-note {
    font-size: 15px;
    line-height: 1.75;
  }

  .project-item {
    padding: 14px;
    border-radius: 14px;
  }

  .project-item-grid {
    gap: 16px;
  }

  .project-name {
    font-size: 20px;
  }

  .project-summary {
    font-size: 14px;
    line-height: 1.65;
  }

  .project-description {
    font-size: 14px;
    line-height: 1.8;
    text-align: left;
  }

  .project-meta {
    grid-template-columns: 1fr;
    gap: 4px 0;
  }

  .project-thumb-frame,
  .project-thumb-empty {
    min-height: 190px;
    padding: 10px;
    border-radius: 12px;
  }

  .project-thumb {
    max-height: 240px;
    border-radius: 4px;
  }

  .project-mini-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .project-mini-card {
    padding: 16px;
    border-radius: 12px;
  }

  .project-mini-text {
    text-align: left;
  }

  .image-modal {
    padding: 2px;
  }

  .image-modal__dialog {
    width: fit-content;
    max-width: calc(100vw - 4px);
    max-height: calc(100vh - 4px);
    margin: 0;
    border-radius: 12px;
  }

  .image-modal__header {
    padding: 12px 48px 8px 12px;
  }

  .image-modal__title {
    font-size: 14px;
  }

  .image-modal__close {
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    font-size: 24px;
  }

  .image-modal__body {
    padding: 12px;
  }

  .image-modal__img {
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 90px);
    border-radius: 8px;
  }
}

@media (max-width: 480px) {
  .hero-small {
    padding: 36px 10px;
  }

  .wrapper-portfolio {
    padding-left: 4px;
    padding-right: 4px;
  }

  .portfolio-block {
    margin-bottom: 12px;
  }

  .project-item {
    padding: 12px;
    border-radius: 12px;
  }

  .project-head {
    margin-bottom: 12px;
  }

  .project-name {
    font-size: 18px;
    margin-bottom: 10px;
  }

  .project-type {
    font-size: 11px;
    padding: 6px 10px;
  }

  .project-summary,
  .project-description,
  .project-meta-value,
  .project-mini-text {
    font-size: 13px;
  }

  .project-meta-label {
    font-size: 12px;
  }

  .project-thumb-frame,
  .project-thumb-empty {
    min-height: 170px;
    padding: 8px;
  }

  .project-thumb {
    max-height: 210px;
  }

  .project-side .project-link,
  .project-side .project-link-disabled,
  .project-mini-card .project-link,
  .project-mini-card .project-link-disabled {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .project-mini-card {
    padding: 14px;
  }
}