:root {
  --wine: #7a1f15;
  --wine-deep: #5c160f;
  --parchment: #f5efed;
  --parchment-dark: #e8dfdb;
  --muted: #6b534e;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
}

body.portfolio-page {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #1a1a1a;
  background: #fff;
  min-height: 100dvh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.portfolio-bg {
  position: fixed;
  inset: 0;
  background-color: #fff;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  z-index: 0;
  pointer-events: none;
}

.portfolio-shell {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 3vw, 2rem);
  padding:
    max(1rem, env(safe-area-inset-top))
    max(1rem, env(safe-area-inset-right))
    max(0.75rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
}

.portfolio-page .app-footer {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  width: 100%;
  border-top: 1px solid var(--parchment-dark);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.portfolio-page .app-footer-copy {
  margin: 0;
  padding: 0.5rem 1rem;
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--muted);
}

.portfolio-page .app-footer-brand {
  font-weight: 700;
  color: var(--wine);
}

.portfolio-page .app-footer-link {
  font-weight: 700;
  color: var(--wine);
  text-decoration: none;
}

.portfolio-page .app-footer-link:hover {
  color: var(--wine-deep);
  text-decoration: underline;
}

.portfolio-page .app-footer-sep {
  margin: 0 0.3rem;
  color: rgba(107, 83, 78, 0.55);
}

.portfolio-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(88vw, 560px);
  background: #fff;
  border-radius: 18px;
  padding: 0.35rem 0.9rem;
  animation: portfolioRise 0.7s ease both;
}

.portfolio-logo {
  display: block;
  width: 100%;
  max-width: 480px;
  max-height: 18vh;
  height: auto;
  object-fit: contain;
}

.portfolio-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(0.85rem, 2.5vw, 1.5rem);
  width: min(100%, 780px);
}

.portfolio-card {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  aspect-ratio: 16 / 10;
  padding: clamp(0.9rem, 2vw, 1.25rem);
  text-decoration: none;
  color: inherit;
  background-color: #2a2422;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 24px;
  box-shadow: 0 16px 36px rgba(20, 20, 20, 0.22);
  overflow: hidden;
  animation: portfolioRise 0.75s ease both;
}

.portfolio-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 8, 8, 0) 45%, rgba(10, 8, 8, 0.4) 100%);
  z-index: 0;
}

.portfolio-card > * {
  position: relative;
  z-index: 1;
}

.portfolio-card.is-live {
  animation-delay: 0.12s;
}

.portfolio-card.is-empty {
  animation-delay: 0.22s;
}

.portfolio-card::before {
  content: '';
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 6px;
  z-index: 2;
}

.portfolio-card.is-live::before {
  background: linear-gradient(90deg, #c1121f 0%, #f4c430 48%, #00a8c6 100%);
}

.portfolio-card.is-empty::before {
  background: linear-gradient(90deg, #1f1f1f 0%, #6b6b6b 100%);
}

.portfolio-card-go {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(16, 12, 12, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  padding: 0.38rem 0.9rem;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.portfolio-card-go::after {
  content: '→';
  font-size: 1rem;
  transition: transform 0.2s ease;
}

.portfolio-card.is-live {
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  -webkit-tap-highlight-color: transparent;
}

.portfolio-card.is-live:hover,
.portfolio-card.is-live:focus-visible {
  transform: translateY(-6px);
  box-shadow: 0 26px 48px rgba(20, 20, 20, 0.3);
  outline: none;
}

.portfolio-card.is-live:hover .portfolio-card-go::after,
.portfolio-card.is-live:focus-visible .portfolio-card-go::after {
  transform: translateX(5px);
}

.portfolio-card.is-empty {
  cursor: default;
  user-select: none;
}

@keyframes portfolioRise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (hover: none) {
  .portfolio-card.is-live:hover {
    transform: none;
  }
}

@media (max-width: 700px) {
  .portfolio-shell {
    gap: 1rem;
    padding: max(0.9rem, env(safe-area-inset-top)) 1rem max(0.9rem, env(safe-area-inset-bottom));
  }

  .portfolio-brand {
    width: min(82vw, 340px);
    border-radius: 14px;
    padding: 0.25rem 0.5rem;
  }

  .portfolio-logo {
    max-width: 300px;
    max-height: 13vh;
  }

  .portfolio-cards {
    grid-template-columns: 1fr;
    gap: 0.85rem;
    width: min(94vw, 400px);
  }

  .portfolio-card {
    aspect-ratio: 16 / 9;
    border-radius: 18px;
  }

  .portfolio-bg {
    background-position: center;
  }
}

@media (max-width: 420px) {
  .portfolio-logo {
    max-width: 240px;
    max-height: 11vh;
  }

  .portfolio-card-go {
    font-size: 0.7rem;
    padding: 0.32rem 0.75rem;
  }
}

@media (max-height: 620px) and (max-width: 700px) {
  .portfolio-logo {
    max-height: 9vh;
  }

  .portfolio-card {
    aspect-ratio: 2 / 1;
  }
}
