/* Página pública de portfólio */

.portfolio-page {
  --pf-accent: #3b82f6;
  --pf-accent-dark: #2563eb;
  --pf-violet: #8b5cf6;
  --pf-dark: #0f172a;
  --pf-surface: #ffffff;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #e8edf4;
  background-image:
    radial-gradient(circle at 15% 10%, rgba(59, 130, 246, 0.09), transparent 42%),
    radial-gradient(circle at 85% 5%, rgba(139, 92, 246, 0.07), transparent 38%),
    radial-gradient(circle at 50% 100%, rgba(15, 23, 42, 0.04), transparent 50%);
  color: var(--text);
  min-height: 100vh;
}

.portfolio-container {
  width: min(1140px, 100% - 2.5rem);
  margin-inline: auto;
}

/* ── Header ── */
.portfolio-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
  transition: background 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

.portfolio-header--scrolled {
  background: rgba(255, 255, 255, 0.94);
  border-bottom-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
}

.portfolio-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
}

.portfolio-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.25s ease;
}

.portfolio-brand:hover {
  transform: scale(1.02);
}

.portfolio-brand__logo {
  width: auto;
  height: 2.5rem;
  max-width: 9rem;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
  opacity: 0.88;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.portfolio-brand--logo-only:hover .portfolio-brand__logo {
  opacity: 1;
  transform: scale(1.04);
}

.portfolio-brand__name {
  line-height: 1.2;
}

.portfolio-brand--logo-only:hover {
  color: inherit;
}

.portfolio-header__cta {
  white-space: nowrap;
  border-radius: 999px;
  padding-inline: 1.1rem;
  font-weight: 600;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.portfolio-header__cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.18);
}

/* ── Hero ── */
.portfolio-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(3rem, 8vw, 5.5rem) 0 clamp(2.5rem, 6vw, 4rem);
  background: linear-gradient(145deg, #0f172a 0%, #1e293b 42%, #172554 100%);
  color: #fff;
}

.portfolio-hero__bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.portfolio-hero__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 20%, transparent 75%);
}

.portfolio-hero__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  animation: portfolio-orb-float 14s ease-in-out infinite;
}

.portfolio-hero__orb--1 {
  width: 420px;
  height: 420px;
  top: -120px;
  right: -80px;
  background: rgba(59, 130, 246, 0.45);
}

.portfolio-hero__orb--2 {
  width: 320px;
  height: 320px;
  bottom: -100px;
  left: -60px;
  background: rgba(139, 92, 246, 0.35);
  animation-delay: -5s;
}

.portfolio-hero__orb--3 {
  width: 200px;
  height: 200px;
  top: 40%;
  left: 45%;
  background: rgba(34, 211, 238, 0.2);
  animation-delay: -9s;
}

@keyframes portfolio-orb-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(20px, -15px) scale(1.05); }
  66% { transform: translate(-15px, 10px) scale(0.97); }
}

.portfolio-hero__content {
  position: relative;
  z-index: 1;
}

.portfolio-hero__eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(147, 197, 253, 0.95);
}

.portfolio-hero__title {
  margin: 0 0 1.15rem;
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.08;
  max-width: 16ch;
  color: #fff;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
  .portfolio-hero__title {
    color: transparent;
  }
}

.portfolio-hero__lead {
  margin: 0;
  max-width: 38rem;
  font-size: 1.08rem;
  color: rgba(226, 232, 240, 0.88);
  line-height: 1.7;
}

.portfolio-hero__actions {
  margin-top: 2rem;
}

.portfolio-page .portfolio-hero__actions .btn-primary {
  border-radius: 999px;
  padding: 0.75rem 1.6rem;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  background: linear-gradient(135deg, var(--pf-accent) 0%, var(--pf-violet) 100%);
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.45);
  transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
}

.portfolio-page .portfolio-hero__actions .btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(59, 130, 246, 0.5);
  filter: brightness(1.06);
}

.btn-lg {
  padding: 0.75rem 1.6rem;
  font-size: 1rem;
}

/* ── Reveal animations ── */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1), transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--reveal-delay, 0ms);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Grid section ── */
.portfolio-grid-section {
  position: relative;
  padding: clamp(2.5rem, 6vw, 4rem) 0 clamp(3rem, 8vw, 5rem);
}

.portfolio-grid-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(15, 23, 42, 0.06) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.5;
  pointer-events: none;
}

.portfolio-section-head {
  position: relative;
  margin-bottom: 2rem;
  text-align: center;
  max-width: 36rem;
  margin-inline: auto;
}

.portfolio-section-eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--pf-accent);
}

.portfolio-section-title {
  margin: 0 0 0.65rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--pf-dark);
}

.portfolio-section-subtitle {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.6;
}

.portfolio-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

/* ── Cards ── */
.portfolio-card {
  background: var(--pf-surface);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  transition:
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.35s ease;
}

.portfolio-card:hover {
  transform: translateY(-8px);
  border-color: rgba(59, 130, 246, 0.28);
  box-shadow:
    0 24px 48px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(59, 130, 246, 0.08);
}

.portfolio-card__header {
  padding: 1rem 1.35rem;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 55%, #1e293b 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.35s ease;
}

.portfolio-card:hover .portfolio-card__header {
  background: linear-gradient(135deg, #172554 0%, #1e40af 55%, #1e293b 100%);
}

.portfolio-card__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: #fff;
}

.portfolio-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
  overflow: hidden;
}

.portfolio-card__media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(15, 23, 42, 0.06) 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.portfolio-card:hover .portfolio-card__media::after {
  opacity: 1;
}

.portfolio-gallery {
  position: relative;
  height: 100%;
}

.portfolio-gallery__viewport {
  height: 100%;
  overflow: hidden;
}

.portfolio-gallery__track {
  display: flex;
  height: 100%;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.portfolio-gallery__slide {
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
  height: 100%;
  overflow: hidden;
}

.portfolio-gallery__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.portfolio-card:hover .portfolio-gallery__slide img {
  transform: scale(1.06);
}

.portfolio-gallery__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transition: opacity 0.3s ease, background 0.2s ease, transform 0.2s ease;
}

.portfolio-card:hover .portfolio-gallery__btn,
.portfolio-gallery__btn:focus-visible {
  opacity: 1;
}

.portfolio-gallery__btn span {
  display: block;
  margin-top: -0.15rem;
}

.portfolio-gallery__btn:hover {
  background: rgba(15, 23, 42, 0.95);
  transform: translateY(-50%) scale(1.08);
}

.portfolio-gallery__btn--prev {
  left: 0.65rem;
}

.portfolio-gallery__btn--next {
  right: 0.65rem;
}

.portfolio-gallery__count {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 0.65rem;
  transform: translateX(-50%);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.portfolio-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.portfolio-card__placeholder {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.portfolio-card__body {
  padding: 1.15rem 1.35rem 1.35rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.5rem;
}

.portfolio-card__desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
  flex: 1;
}

.portfolio-card__price {
  margin: 0.35rem 0 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: #15803d;
  letter-spacing: -0.02em;
}

.portfolio-card__pricing {
  margin-top: 0.35rem;
}

.portfolio-card__price-row {
  display: inline-flex;
  align-items: flex-end;
  gap: 0.4rem;
}

.portfolio-card__price-row .portfolio-card__price {
  margin: 0;
  line-height: 1;
}

.portfolio-card__price--old {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: line-through;
  margin: 0 0 0.12rem;
  line-height: 1;
  white-space: nowrap;
}

.portfolio-card__promo-badge {
  display: inline-block;
  margin-bottom: 0.35rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.35);
}

.portfolio-card__link {
  margin-top: 0.85rem;
  align-self: flex-start;
  border-radius: 999px;
  font-weight: 600;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.portfolio-card__link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
  background: var(--pf-dark);
  color: #fff;
  border-color: var(--pf-dark);
}

/* ── Empty & Footer ── */
.portfolio-empty {
  padding: 4rem 0;
  text-align: center;
}

.portfolio-empty .btn {
  margin-top: 1.25rem;
  border-radius: 999px;
}

.portfolio-footer {
  padding: 2.25rem 0;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  text-align: center;
}

.portfolio-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  letter-spacing: 0.01em;
}

/* ── Modal demonstração ── */
.portfolio-modal {
  width: min(480px, calc(100% - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: none;
  border-radius: 16px;
  background: transparent;
  overflow: visible;
}

.portfolio-modal::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}

.portfolio-modal__inner {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

.portfolio-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.35rem;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  color: #fff;
}

.portfolio-modal__head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.portfolio-modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
}

.portfolio-modal__close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.portfolio-modal__form {
  padding: 1.35rem;
  gap: 1rem;
}

.portfolio-modal__form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.portfolio-modal__form label select.input {
  width: 100%;
  cursor: pointer;
}

.portfolio-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 0.25rem;
}

.portfolio-modal__actions .btn-primary {
  border-radius: 999px;
}

/* ── Toast ── */
.portfolio-toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  max-width: min(420px, calc(100% - 2rem));
  padding: 0.85rem 1.15rem;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.portfolio-toast--ok {
  background: #ecfdf5;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.portfolio-toast--error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.portfolio-toast--hide {
  opacity: 0;
  transform: translateY(-8px);
}

@media (prefers-reduced-motion: reduce) {
  .portfolio-hero__orb {
    animation: none;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .portfolio-card,
  .portfolio-gallery__slide img,
  .portfolio-gallery__btn {
    transition: none;
  }

  .portfolio-card:hover {
    transform: none;
  }

  .portfolio-card:hover .portfolio-gallery__slide img {
    transform: none;
  }

  .portfolio-gallery__btn {
    opacity: 1;
  }
}

@media (max-width: 600px) {
  .portfolio-header__inner {
    flex-wrap: wrap;
  }

  .portfolio-hero__title {
    max-width: none;
  }

  .portfolio-grid {
    grid-template-columns: 1fr;
  }

  .portfolio-gallery__btn {
    opacity: 1;
  }
}

.portfolio-admin-thumb {
  width: 72px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.portfolio-admin-logo-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.portfolio-admin-logo-preview img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  padding: 0.25rem;
}

.portfolio-admin-preview {
  display: block;
  max-width: 280px;
  margin-top: 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.portfolio-admin-images {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.portfolio-admin-image-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 120px;
  font-size: 0.85rem;
}

.portfolio-admin-image-item img {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.portfolio-admin-image-item__label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
}

/* Grelha de cards no admin (semelhante à página pública) */
.portfolio-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.portfolio-admin-card {
  height: 100%;
}

.portfolio-admin-card--inactive {
  opacity: 0.72;
}

.portfolio-admin-card--inactive .portfolio-card__media {
  filter: grayscale(0.35);
}

.portfolio-admin-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.portfolio-admin-card__header .portfolio-card__title {
  flex: 1;
  min-width: 0;
}

.portfolio-admin-card__badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}

.portfolio-admin-badge {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  white-space: nowrap;
}

.portfolio-admin-badge--order {
  background: rgba(255, 255, 255, 0.22);
}

.portfolio-admin-badge--active {
  background: #15803d;
  color: #fff;
}

.portfolio-admin-badge--inactive {
  background: #6b7280;
  color: #fff;
}

.portfolio-admin-card__link {
  margin: 0;
  word-break: break-all;
}

.portfolio-admin-card__link a {
  color: inherit;
}

.portfolio-admin-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.portfolio-admin-card__actions .form-inline-delete {
  margin: 0;
}

@media (max-width: 600px) {
  .portfolio-admin-grid {
    grid-template-columns: 1fr;
  }
}
