/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: var(--header-h);
  transition: background 0.3s, box-shadow 0.3s, backdrop-filter 0.3s;
}

.header.is-scrolled {
  background: var(--surface-glass);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--border);
}

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

.logo {
  font-family: var(--font-display);
  font-size: 2.80rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  flex-shrink: 0;
}

.logo span {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav__link {
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-radius: 100px;
  transition: color 0.2s, background 0.2s;
}

.nav__link:hover { color: var(--text); background: rgba(124, 92, 191, 0.06); }
.nav__link.active { color: var(--violet); }

.header__cta {
  margin-left: 8px;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--violet);
  border-radius: 1px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s, background 0.25s;
}

.btn--primary {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: 0 4px 20px rgba(124, 92, 191, 0.25);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(124, 92, 191, 0.35);
}

.btn--ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  border-color: var(--violet);
  color: var(--violet);
}

.btn--magnetic { position: relative; }

.btn--full { width: 100%; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}

.card:hover {
  border-color: rgba(124, 92, 191, 0.25);
  box-shadow: var(--shadow-md);
}

/* Form */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--muted);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.form-group select:invalid {
  color: var(--muted);
}

.form-group select option {
  color: var(--text);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(77, 171, 247, 0.12);
}

.form-group input.error,
.form-group textarea.error,
.form-group select.error {
  border-color: var(--rose);
}

.form-error {
  display: block;
  font-size: 0.75rem;
  color: var(--rose);
  margin-top: 4px;
}

.form-error[hidden] {
  display: none;
}

.form-feedback {
  margin-top: 16px;
}

.form-feedback-message {
  padding: 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.form-feedback-message--success {
  background: rgba(46, 196, 182, 0.1);
  border: 1px solid rgba(46, 196, 182, 0.3);
  color: #1a9e92;
}

.form-feedback-message--error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #c53030;
}

/* Modal */
.modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 640px;
  width: 92%;
}

.modal::backdrop {
  background: rgba(26, 29, 43, 0.5);
  backdrop-filter: blur(4px);
}

.modal__box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  position: relative;
  box-shadow: var(--shadow-md);
}

.modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}

.portfolio__open-btn { margin-top: 20px; }
.form-note { margin-top: 12px; font-size: 0.75rem; color: var(--muted); }
.modal__preview { margin-top: 20px; border-radius: var(--radius); min-height: 200px; padding: 24px; }

@media (max-width: 900px) {
  .nav-toggle { display: flex; }

  .nav {
    position: fixed;
    top: var(--header-h);
    left: 16px;
    right: 16px;
    flex-direction: column;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transform: translateY(-120%);
    opacity: 0;
    transition: 0.3s var(--ease);
  }

  .nav.open { transform: translateY(0); opacity: 1; }

  .nav__link { width: 100%; text-align: center; padding: 14px; }

  .header__cta { display: none; }
}

@media (max-width: 768px) {
  .container {
    width: min(var(--container), calc(100% - 40px));
  }

  .card {
    padding: 20px;
  }

  .btn {
    min-height: 44px;
  }

  .form-group input,
  .form-group textarea,
  .form-group select {
    width: 100%;
    min-width: 0;
    font-size: 16px;
    min-height: 44px;
  }

  .form-group textarea {
    min-height: 120px;
    resize: vertical;
  }

  .header__inner {
    gap: 14px;
    min-width: 0;
  }

  .nav {
    left: 12px;
    right: 12px;
    max-width: calc(100vw - 24px);
  }

  .nav__link {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .nav-toggle {
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
  }

  .modal {
    width: calc(100% - 32px);
    max-height: calc(100dvh - 32px);
  }

  .modal__box {
    padding: 24px 20px;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .modal__close {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .nav__link:focus-visible,
  .nav-toggle:focus-visible,
  .btn:focus-visible {
    outline: 2px solid var(--sky);
    outline-offset: 2px;
  }
}

@media (max-width: 360px) {
  .container {
    width: min(var(--container), calc(100% - 32px));
  }

  .card {
    padding: 18px;
  }

  .logo {
    font-size: 2rem;
    letter-spacing: 0.05em;
  }

  .header__inner {
    gap: 10px;
  }
}