/* === RESET === */

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

/* === CUSTOM PROPERTIES === */

:root {
  /* Colors */
  --color-bg: oklch(15% 0.011 276);
  --color-input-bg: oklch(28% 0.037 261);
  --color-surface: oklch(21% 0.04 265);
  --color-accent: oklch(55% 0.215 263);
  --color-cta: oklch(57% 0.222 20);
  --color-cta-hover: oklch(50% 0.194 21);
  --color-text: oklch(100% 0 0);
  --color-text-muted: oklch(71% 0.035 251);
  --color-success: oklch(72% 0.194 150);
  --color-error: oklch(64% 0.207 26);
  --color-border: oklch(37% 0.039 257);

  /* Typography */
  --font-heading: "Montserrat", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --text-body: 16px;
  --text-label: 14px;
  --text-heading: 24px;
  --text-display: 32px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Layout */
  --container-max: 1600px;
}

/* === TYPOGRAPHY === */

body {
  font-family: var(--font-body);
  font-size: var(--text-body);
  color: var(--color-text);
  background-color: var(--color-bg);

  &.no-scroll {
    overflow: hidden;
  }
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
}

h1 {
  font-size: clamp(2.5rem, 2.5vw + 1rem, 5rem);
}

h2 {
  font-size: var(--text-heading);

  @media (min-width: 768px) {
    font-size: 28px;
  }

  @media (min-width: 1440px) {
    font-size: 32px;
  }
}

/* === LAYOUT === */

.container {
  width: 100%;
  max-width: 90%;
  margin-inline: auto;

  @media (min-width: 768px) {
    padding-inline: var(--space-lg);
  }

  @media (min-width: 1440px) {
    padding-inline: var(--space-xl);
  }

  @media (min-width: 1900px) {
    max-width: var(--container-max);
  }
}

/* === BUTTONS === */

.btn-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-cta);
  color: var(--color-text);
  font-family: var(--font-heading);
  font-weight: 700;
  padding: var(--space-md) var(--space-xl);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  min-height: 44px;
  text-decoration: none;
  transition: background-color 0.2s ease;

  &:hover {
    background-color: var(--color-cta-hover);
  }

  &:active {
    background-color: var(--color-cta-hover);
    transform: scale(0.97);
  }
}

/* === HEADER === */

header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in oklch, var(--color-surface) 70%, transparent);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);

  &::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  & .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
  }
}

.header-logo {
  flex-shrink: 0;

  & img {
    height: 100px;
    width: auto;

    @media (min-width: 768px) {
      height: 130px;
    }
  }
}

.header-nav {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: color-mix(in oklch, var(--color-surface) 95%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xl);
  transform: translateX(100%);
  transition: transform 0.3s ease;

  &.nav-menu-open {
    transform: translateX(0);
  }

  @media (min-width: 1024px) {
    position: static;
    inset: auto;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: var(--space-lg);
    flex: 1;
    transform: none;
    transition: none;
  }
}

.nav-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);

  & a {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: var(--text-heading);
    color: var(--color-text-muted);
    transition: color 0.2s ease;
    white-space: nowrap;

    &:hover {
      color: var(--color-text);
    }
  }

  @media (min-width: 1024px) {
    flex-direction: row;
    justify-content: center;
    gap: var(--space-lg);
    flex: 1;

    & a {
      font-size: var(--text-label);
    }
  }
}

.nav-phone {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-heading);
  font-weight: 700;

  @media (min-width: 1024px) {
    font-size: var(--text-label);
    transition: color 0.2s ease;

    &:hover {
      color: var(--color-accent);
    }
  }
}

.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
  min-width: 44px;
  min-height: 44px;
  margin-left: auto;
  z-index: 101;

  @media (min-width: 1024px) {
    display: none;
  }

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

    & .nav-bar:nth-child(2) {
      opacity: 0;
      transform: scaleX(0);
    }

    & .nav-bar:nth-child(3) {
      transform: translateY(-8px) rotate(-45deg);
    }
  }
}

.nav-toggle-icon {
  display: block;
  fill: var(--color-text);
}

.nav-bar {
  transform-box: fill-box;
  transform-origin: center;
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}

/* === HERO === */

.hero {
  position: relative;
  min-height: 80vh;
  display: flex;
  align-items: center;
  background: linear-gradient(
    135deg,
    var(--color-bg) 0%,
    var(--color-surface) 100%
  );
  padding-block: var(--space-3xl) var(--space-2xl);
}

.hero-content {
  text-align: center;
  margin-inline: auto;
  max-width: max-content;
  position: relative;
  z-index: 1;

  @media (min-width: 768px) {
    background-color: color-mix(
      in oklch,
      var(--color-surface) 65%,
      transparent
    );
    backdrop-filter: blur(4px);
    padding: var(--space-3xl) var(--space-2xl);
    border-radius: 20px;
  }

  @media (min-width: 1024px) {
    text-align: left;
    margin-inline: 0;
  }
}

.hero-subtitle {
  font-size: var(--text-body);
  color: var(--color-text-muted);
  max-width: 460px;
  line-height: 1.6;

  @media (min-width: 768px) {
    font-size: 18px;
  }
}

.hero-cta {
  align-self: flex-start;
  padding: var(--space-md) var(--space-2xl);
  margin-top: var(--space-xl);
}

.hero-image {
  display: none;

  @media (min-width: 768px) {
    display: block;
    position: absolute;
    bottom: 0;
    inset-inline: 0;
    width: 100%;
  }
}

/* === STATS === */

.stats {
  padding-block: var(--space-2xl);
  background-color: var(--color-surface);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  text-align: center;
}

.stats-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.stat-value {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 48px;
  line-height: 1;
  color: var(--color-accent);

  @media (min-width: 768px) {
    font-size: 64px;
  }
}

.stat-label {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--text-label);
  color: var(--color-text-muted);
}

/* === PROCESS === */

.process {
  padding-block: var(--space-3xl) var(--space-2xl);

  @media (hover: hover) and (pointer: fine) {
    & .process-card:hover {
      transform: perspective(600px) rotateX(4deg) translateY(-6px);
    }
  }
}

.process-heading {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.process-grid {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: 1fr;

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

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

.process-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: var(--space-lg);
  transition: transform 0.2s ease;
}

.process-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.process-card-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.process-card-number {
  font-family: var(--font-heading);
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
  color: var(--color-text-muted);
  opacity: 0.3;
}

.process-card-title {
  font-size: 18px;
  margin-bottom: var(--space-sm);
}

.process-card-desc {
  font-size: var(--text-label);
  color: var(--color-text-muted);
  line-height: 1.6;

  & a {
    color: var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 2px;

    &:hover {
      opacity: 0.8;
    }
  }
}

/* === ADVANTAGES === */

.advantages {
  background-color: var(--color-surface);
  padding-block: var(--space-3xl) var(--space-2xl);

  @media (hover: hover) and (pointer: fine) {
    & .advantage-card:hover {
      transform: perspective(600px) rotateX(4deg) translateY(-6px);
    }
  }
}

.advantages-heading {
  text-align: center;
  margin-bottom: var(--space-md);
}

.advantages-subtitle {
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--text-body);
  margin-bottom: var(--space-2xl);
  max-width: 500px;
  margin-inline: auto;
}

.advantages-grid {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: 1fr;

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

.advantage-card {
  background-color: var(--color-input-bg);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-accent);
  border-radius: 12px;
  padding: var(--space-lg);
  transition: transform 0.2s ease;
}

.advantage-card-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  margin-bottom: var(--space-md);
  color: var(--color-accent);
}

.advantage-card-title {
  font-size: 18px;
  margin-bottom: var(--space-sm);
}

.advantage-card-desc {
  font-size: var(--text-label);
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* === PORTFOLIO === */

.portfolio {
  padding-block: var(--space-3xl) var(--space-2xl);
}

.portfolio-heading {
  text-align: center;
  margin-bottom: var(--space-md);
}

.portfolio-subtitle {
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--text-body);
  margin-bottom: var(--space-2xl);
  max-width: 500px;
  margin-inline: auto;
}

/* --- Carousel --- */

.portfolio-carousel {
  position: relative;
  overflow: hidden;
}

.portfolio-track {
  display: flex;
  gap: var(--space-lg);
  transition: transform 0.3s ease;
}

.portfolio-card {
  flex: 0 0 100%;
  min-width: 0;

  @media (min-width: 768px) {
    flex: 0 0 calc((100% - var(--space-lg)) / 2);
  }

  @media (min-width: 1440px) {
    flex: 0 0 calc((100% - 2 * var(--space-lg)) / 3);
  }
}

.portfolio-card-label {
  text-align: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-label);
  color: var(--color-text-muted);
  margin-top: var(--space-sm);
}

/* --- Carousel Arrows --- */

.portfolio-carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-100%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: color-mix(in oklch, var(--color-surface) 85%, transparent);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  transition:
    background-color 0.2s ease,
    opacity 0.2s ease;

  &:hover {
    background-color: var(--color-accent);
  }

  &:disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
  }
}

.portfolio-carousel-arrow-prev {
  left: var(--space-sm);
}

.portfolio-carousel-arrow-next {
  right: var(--space-sm);
}

/* --- Before/After Slider --- */

.ba-slider {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  cursor: ew-resize;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.ba-slider-after {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ba-slider-before {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  clip-path: polygon(0 0, 30% 0, 30% 100%, 0 100%);
}

.ba-slider-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 30%;
  width: 4px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
  pointer-events: none;
}

.ba-slider-line {
  flex: 1;
  width: 2px;
  background: var(--color-text);
  opacity: 0.8;
}

.ba-slider-knob {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-text);
  border: 2px solid var(--color-accent);
  color: var(--color-bg);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: ew-resize;
  flex-shrink: 0;
  line-height: 1;
}

.ba-slider-label {
  position: absolute;
  top: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-label);
  color: var(--color-text);
  background: color-mix(in oklch, black 50%, transparent);
  border-radius: 4px;
  pointer-events: none;
  z-index: 1;
}

.ba-slider-label-before {
  left: var(--space-sm);
}

.ba-slider-label-after {
  right: var(--space-sm);
}

/* === CONTACT FORM === */

.contact {
  padding-block: var(--space-3xl) var(--space-2xl);
  background-color: var(--color-surface);
}

.contact-heading {
  text-align: center;
  margin-bottom: var(--space-md);
}

.contact-subtitle {
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--text-body);
  margin-bottom: var(--space-2xl);
  max-width: 500px;
  margin-inline: auto;
}

.contact-form {
  max-width: 480px;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-label {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-label);
  color: var(--color-text);
}

.form-required {
  color: var(--color-cta);
}

.form-input {
  width: 100%;
  padding: var(--space-md);
  font-family: var(--font-body);
  font-size: var(--text-body);
  color: var(--color-text);
  background-color: var(--color-input-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s ease;
  min-height: 44px;

  &::placeholder {
    color: var(--color-text-muted);
    opacity: 0.6;
  }

  &:focus {
    border-color: var(--color-accent);
  }
}

.form-input-invalid {
  border-color: var(--color-error);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-md) center;
  padding-right: calc(var(--space-md) * 3);
  cursor: pointer;

  &:has(option[value=""]:checked) {
    color: color-mix(in oklch, var(--color-text-muted) 60%, transparent);
  }

  & option {
    color: var(--color-text);
  }
}

.form-error {
  font-size: var(--text-label);
  color: var(--color-error);
  min-height: 0;
  overflow: hidden;
  transition: min-height 0.2s ease;

  &:empty {
    display: none;
  }
}

.contact-form-submit {
  width: 100%;
  margin-top: var(--space-sm);
  font-size: 18px;
  padding: var(--space-md) var(--space-xl);
}

/* === FORM SUBMISSION STATES === */

.form-group-hp {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
  height: 0;
  overflow: hidden;
}

.btn-cta-loading {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

.form-error-submit {
  display: block;
  text-align: center;
  margin-top: var(--space-sm);

  &:empty {
    display: none;
  }
}

.success-dialog {
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background-color: var(--color-surface);
  color: var(--color-text);
  padding: var(--space-2xl);
  max-width: 400px;
  width: calc(100% - var(--space-xl) * 2);
  text-align: center;
  margin: auto;

  &::backdrop {
    background-color: color-mix(in oklch, black 60%, transparent);
    backdrop-filter: blur(4px);
  }
}

.success-dialog-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.success-dialog-icon {
  width: 64px;
  height: 64px;
}

.success-dialog-title {
  font-size: 24px;
}

.success-dialog-text {
  color: var(--color-text-muted);
  font-size: var(--text-body);
  margin: 0;
}

.success-dialog-close {
  margin-top: var(--space-sm);
  min-width: 160px;
}

/* === FOOTER === */

footer {
  padding-block: var(--space-2xl) var(--space-lg);
  border-top: 1px solid var(--color-border);
  background-color: var(--color-bg);
}

.footer-grid {
  display: grid;
  gap: var(--space-xl);
  grid-template-columns: 1fr;

  @media (min-width: 768px) {
    grid-template-columns: 1fr repeat(2, max-content);
  }
}

.footer-logo img {
  height: 80px;
  width: auto;
}

.footer-tagline {
  font-size: var(--text-label);
  color: var(--color-text-muted);
}

.footer-col-brand {
  justify-self: center;

  @media (min-width: 768px) {
    justify-self: start;
  }
}

.footer-col-title {
  font-size: var(--text-body);
  margin-bottom: var(--space-md);
}

.footer-contacts,
.footer-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-label);
  color: var(--color-text-muted);
  transition: color 0.2s ease;

  &:hover {
    color: var(--color-text);
  }
}

.footer-icon {
  flex-shrink: 0;
}

.footer-bottom {
  margin-top: var(--space-2xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.footer-copyright {
  font-size: var(--text-label);
  color: var(--color-text-muted);
}

/* === SCROLL ANIMATIONS === */

.js-hidden {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1) var(--stagger-delay, 0ms),
    transform 0.6s cubic-bezier(0.16, 1, 0.3, 1) var(--stagger-delay, 0ms);

  &.js-visible {
    opacity: 1;
    transform: translateY(0);
  }

  @media (prefers-reduced-motion: reduce) {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

#process,
#advantages,
#portfolio,
#contact {
  scroll-margin-top: var(--header-height);
}

/* === SKIP LINK (Accessibility) === */

.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-accent);
  color: var(--color-text);
  padding: var(--space-sm) var(--space-md);
  border-radius: 4px;
  z-index: 1000;
  font-family: var(--font-body);
  font-size: var(--text-label);
  text-decoration: none;
  white-space: nowrap;

  &:focus {
    top: var(--space-sm);
  }
}

/* === NOTFOUND (404) PAGE === */
.notfound-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notfound-card {
  max-width: 400px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  background-color: var(--color-surface);
  border-radius: 12px;
  padding: var(--space-2xl);

  & p {
    color: var(--color-text-muted);
  }

  & a {
    margin-top: var(--space-md);
  }
}
