:root {
  --color-bg: #f8f9fa;
  --color-surface: #ffffff;
  --color-surface-low: #f3f4f5;
  --color-surface-high: #e7e8e9;
  --color-text: #191c1d;
  --color-text-muted: #464555;
  --color-border: #e5e7eb;
  --color-border-strong: #c7c4d8;
  --color-accent: #4f46e5;
  --color-accent-hover: #4338ca;
  --color-accent-soft: #e2dfff;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05);

  --container-max: 1200px;
  --header-height: 80px;
  --section-gap: 160px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

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

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

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

.container--narrow {
  max-width: 640px;
}

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.site-header.is-scrolled {
  border-bottom-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

.nav {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav__brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.nav__brand span {
  color: var(--color-accent);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav__link {
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.nav__link:hover {
  color: var(--color-text);
  background-color: var(--color-surface-low);
}

.nav__link.is-active {
  color: var(--color-accent);
}

.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0 10px;
  border: 0;
  background: none;
  cursor: pointer;
}

.nav__toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}

.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 32px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease),
    border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.btn--primary {
  background-color: var(--color-accent);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.btn--primary:hover {
  background-color: var(--color-accent-hover);
  transform: translateY(-1px);
}

.btn--outline {
  background-color: transparent;
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.btn--outline:hover {
  background-color: var(--color-surface-low);
}

.btn--sm {
  padding: 8px 20px;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  background-color: var(--color-surface-low);
  border: 1px solid var(--color-border);
  border-radius: 999px;
}

.badge__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-accent);
}

/* Hero */
.hero {
  padding-top: calc(var(--header-height) + 96px);
  padding-bottom: 64px;
}

.hero__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 48px;
}

.hero__content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
}

.hero__title {
  margin: 0;
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.hero__desc {
  margin: 0;
  max-width: 560px;
  font-size: 18px;
  line-height: 1.6;
  text-align: justify;
  color: var(--color-text-muted);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 8px;
}

.hero__media {
  display: flex;
  justify-content: center;
}

.hero__photo {
  width: min(320px, 100%);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 16px;
  border: 4px solid var(--color-surface);
  box-shadow: var(--shadow-md);
}

/* Sections */
.section {
  padding: var(--section-gap) 0;
}

.section--alt {
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.section__head {
  margin-bottom: 48px;
}

.section__head--center {
  text-align: center;
}

.section__head--center .section__subtitle {
  margin-left: auto;
  margin-right: auto;
}

.section__title {
  margin: 0 0 8px;
  font-size: 32px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section__subtitle {
  margin: 0;
  max-width: 520px;
  font-size: 16px;
  color: var(--color-text-muted);
}

/* Tech Stack */
.stack-card {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 20px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.stack-card__items {
  display: grid;
  grid-template-columns: repeat(4, auto);
  justify-content: center;
  gap: 10px;
}

.stack-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 108px;
  padding: 12px;
  background-color: #ffffff;
  border: 1px solid var(--color-border);
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}

.stack-item:hover {
  transform: translateY(-3px);
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-sm);
}

.stack-item__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
}

.stack-item__icon img {
  width: 38px;
  height: 38px;
  display: block;
}

.stack-item__name {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-text-muted);
  text-align: center;
}

/* Projects */
.project-grid {
  display: flex;
  align-items: stretch;
  gap: 24px;
  margin: 0 -24px;
  padding: 4px 24px 16px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-strong) transparent;
  -webkit-overflow-scrolling: touch;
}

.project-grid::-webkit-scrollbar {
  height: 8px;
}

.project-grid::-webkit-scrollbar-track {
  background: transparent;
}

.project-grid::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: 999px;
}

.project-card {
  display: flex;
  flex-direction: column;
  flex: 0 0 calc((100% - 48px) / 3);
  min-width: 0;
  scroll-snap-align: start;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.section__head--controls {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.project-controls {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.project-controls__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0 0 2px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  color: var(--color-text);
  background-color: var(--color-surface);
  cursor: pointer;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease),
    color 0.2s var(--ease), opacity 0.2s var(--ease);
}

.project-controls__btn:hover:not(:disabled) {
  border-color: var(--color-accent);
  background-color: var(--color-accent);
  color: #ffffff;
}

.project-controls__btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.project-card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md);
}

.project-card__media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background-color: var(--color-surface-high);
}

.project-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}

/* Project slider */
.project-slider {
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.project-slider.is-dragging {
  cursor: grabbing;
}

.project-slider__track {
  display: flex;
  height: 100%;
  transition: transform 0.4s var(--ease);
  will-change: transform;
}

.project-slider.is-dragging .project-slider__track {
  transition: none;
}

.project-slider__slide {
  flex: 0 0 100%;
  min-width: 100%;
  height: 100%;
}

.project-slider__slide img {
  pointer-events: none;
}

.project-card:hover .project-slider__slide img,
.project-slider__slide img {
  transform: none;
}

.project-slider__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0 0 2px;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  color: var(--color-text);
  background-color: rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s var(--ease), background-color 0.2s var(--ease);
}

.project-card:hover .project-slider__btn,
.project-slider__btn:focus-visible {
  opacity: 1;
}

.project-slider__btn:hover {
  background-color: #ffffff;
}

.project-slider__btn--prev {
  left: 10px;
}

.project-slider__btn--next {
  right: 10px;
}

.project-slider__dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  gap: 6px;
}

.project-slider__dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: width 0.2s var(--ease), background-color 0.2s var(--ease);
}

.project-slider__dot.is-active {
  width: 20px;
  background-color: #ffffff;
}

@media (hover: none) {
  .project-slider__btn {
    opacity: 1;
  }
}

.animated-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 20px;
  border: 3px solid transparent;
  font-size: 12px;
  font-family: var(--font-sans);
  background-color: #ffffff;
  border-radius: 100px;
  font-weight: 600;
  color: #1f387e;
  box-shadow: 0 0 0 2px #ffffff;
  cursor: pointer;
  overflow: hidden;
  text-decoration: none;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.animated-button svg {
  position: absolute;
  width: 18px;
  fill: #1f387e;
  z-index: 9;
  transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.animated-button .arr-1 {
  right: 12px;
}

.animated-button .arr-2 {
  left: -25%;
}

.animated-button .circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  background-color: #c5e5e4;
  border-radius: 50%;
  opacity: 0;
  transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.animated-button .text {
  position: relative;
  z-index: 1;
  transform: translateX(-8px);
  transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.animated-button:hover {
  box-shadow: 0 0 0 12px transparent;
  color: #212121;
  border-radius: 12px;
}

.animated-button:hover .arr-1 {
  right: -25%;
}

.animated-button:hover .arr-2 {
  left: 16px;
}

.animated-button:hover .text {
  transform: translateX(8px);
}

.animated-button:hover svg {
  fill: #1f387e;
}

.animated-button:active {
  scale: 0.95;
  box-shadow: 0 0 0 4px greenyellow;
}

.animated-button:hover .circle {
  width: 120px;
  height: 120px;
  opacity: 1;
}

.project-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 12px;
  padding: 24px;
}

.project-card__title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.project-card__desc {
  margin: 0;
  flex: 1;
  font-size: 15px;
  color: var(--color-text-muted);
}

.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-card__tags li {
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text-muted);
  background-color: var(--color-surface);
  border-radius: 4px;
}

.project-card__icons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 4px 0;
}

.project-card__icons li {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease);
}

.project-card__icons li:hover {
  transform: translateY(-2px);
  border-color: var(--color-border-strong);
}

.project-card__icons img {
  width: 20px;
  height: 20px;
  display: block;
}

.project-card__links {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.btn-github {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.825rem;
  line-height: 1rem;
  font-weight: 800;
  color: #ffffff;
  background-color: rgba(0, 0, 0, 0.4);
  border: none;
  border-radius: 100px;
  cursor: pointer;
  place-content: center;
  box-shadow:
    inset 0 1px 0 0 rgba(255, 255, 255, 0.04),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.btn-github:hover {
  box-shadow:
    inset 0 1px 0 0 rgba(255, 255, 255, 0.08),
    inset 0 0 0 1px rgba(252, 232, 3, 0.08);
  color: #fce803;
  transform: translate(0, -0.25rem);
  background-color: rgba(0, 0, 0, 0.5);
}

.link {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--color-accent);
}

.link:hover {
  text-decoration: underline;
}

.link--muted {
  color: var(--color-text-muted);
}

.link--muted:hover {
  color: var(--color-text);
}

/* Contact */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 32px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.contact-social {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 32px;
}

.Btn {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background-color: transparent;
  position: relative;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
}

.Btn .svgContainer {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  backdrop-filter: blur(0px);
  letter-spacing: 0.8px;
  border-radius: 10px;
  transition: all 0.3s;
  border: 1px solid rgba(156, 156, 156, 0.466);
}

.Btn .svgContainer svg {
  width: 30px;
  height: 30px;
}

.Btn .BG {
  position: absolute;
  content: "";
  width: 100%;
  height: 100%;
  background: #181818;
  z-index: -1;
  border-radius: 10px;
  pointer-events: none;
  transition: all 0.3s;
}

.Btn--linkedin .BG {
  background: #0077b5;
}

.Btn--instagram .BG {
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  border-radius: 9px;
}

.Btn:hover .BG {
  transform: rotate(35deg);
  transform-origin: bottom;
}

.Btn:hover .svgContainer {
  background-color: rgba(156, 156, 156, 0.466);
  backdrop-filter: blur(4px);
}

/* Footer */
.site-footer {
  padding: 48px 0;
  background-color: var(--color-surface-low);
  border-top: 1px solid var(--color-border);
}

.site-footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.site-footer__brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.site-footer__brand span {
  color: var(--color-accent);
}

.site-footer__copy {
  margin: 0;
  font-size: 14px;
  color: var(--color-text-muted);
}

/* Responsive */
@media (max-width: 1024px) {
  .project-card {
    flex-basis: calc((100% - 24px) / 2);
  }
}

@media (max-width: 768px) {
  :root {
    --section-gap: 96px;
  }

  .nav__toggle {
    display: flex;
  }

  .nav__links {
    position: fixed;
    top: var(--header-height);
    right: 0;
    left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 16px 24px 24px;
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    transform: translateY(-110%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s var(--ease), opacity 0.3s var(--ease),
      visibility 0.3s;
  }

  .nav__links.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav__link {
    display: block;
    padding: 14px 12px;
    font-size: 16px;
  }

  .hero {
    padding-top: calc(var(--header-height) + 48px);
  }

  .hero__grid {
    grid-template-columns: 1fr;
    gap: 40px;
    text-align: center;
  }

  .hero__content {
    order: 2;
    align-items: center;
  }

  .hero__actions {
    justify-content: center;
  }

  .hero__media {
    order: 1;
  }

  .hero__photo {
    width: 192px;
  }

  .section__head:not(.section__head--center) {
    text-align: center;
  }

  .section__head:not(.section__head--center) .section__subtitle {
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 640px) {
  .project-card {
    flex-basis: 85%;
  }

  .section__head--controls {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .stack-card__items {
    grid-template-columns: repeat(3, auto);
  }

  .stack-item {
    padding: 10px;
  }

  .contact-form {
    padding: 24px;
  }

  .contact-form .btn {
    align-self: stretch;
  }
}

@media (max-width: 420px) {
  .stack-card__items {
    grid-template-columns: repeat(2, auto);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
