/* ==========================================================================
   Section 07 — Portfolio
   ========================================================================== */

/* Filters ---------------------------------------------------------------- */
.portfolio__toolbar {
  margin: calc(var(--space-5) * -1) 0 var(--space-6);
}

.portfolio__filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
}
.portfolio__filters[hidden] { display: none; }

.portfolio__filter {
  padding: 9px 18px;
  font-family: var(--font-heading);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: color 0.25s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.portfolio__filter:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.portfolio__filter[aria-pressed="true"] {
  color: var(--text);
  background: var(--gradient);
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(124, 92, 255, 0.35);
}

/* Grid ------------------------------------------------------------------- */
/* Flex-wrap (not CSS grid) so a filtered, partial row stays centered. */
.portfolio__grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-5);
}
.portfolio__item { width: 100%; }

@media (min-width: 640px) {
  .portfolio__item { width: calc((100% - var(--space-5)) / 2); }
}

@media (min-width: 1024px) {
  .portfolio__grid { gap: var(--space-6) var(--space-5); }
  .portfolio__item { width: calc((100% - 2 * var(--space-5)) / 3); }
}

/* Each item is the grid cell + filter animation target. */
.portfolio__item {
  display: flex;
  transform-origin: 50% 40%;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
.portfolio__item[hidden] { display: none; }
.portfolio__item.is-hiding {
  opacity: 0;
  transform: scale(0.94);
  pointer-events: none;
}

/* Reveal wrapper (main.js) — kept separate so it can't fight the card hover. */
.portfolio__reveal {
  display: flex;
  flex: 1;
  min-width: 0;
}

/* Card ------------------------------------------------------------------- */
.portfolio__card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

/* Thumbnail (pure-CSS browser mockup) ------------------------------------ */
.portfolio__thumb {
  --thumb-a: rgba(124, 92, 255, 0.95);
  --thumb-b: rgba(34, 211, 238, 0.75);
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--gradient-soft), var(--surface-2);
}

/* soft sheen on top of the gradient */
.portfolio__thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(80% 60% at 50% 0%, rgba(124, 92, 255, 0.12), transparent 70%);
  pointer-events: none;
}

.portfolio__thumb--bloom {
  --thumb-a: rgba(244, 114, 182, 0.95);
  --thumb-b: rgba(124, 92, 255, 0.75);
  background:
    radial-gradient(110% 90% at 0% 0%, rgba(244, 114, 182, 0.5), transparent 60%),
    radial-gradient(90% 80% at 100% 100%, rgba(124, 92, 255, 0.4), transparent 60%),
    var(--surface-2);
}

.portfolio__thumb--urbanfit {
  --thumb-a: rgba(244, 114, 182, 0.9);
  --thumb-b: rgba(34, 211, 238, 0.8);
  background:
    radial-gradient(100% 90% at 100% 0%, rgba(244, 114, 182, 0.45), transparent 60%),
    radial-gradient(100% 90% at 0% 100%, rgba(34, 211, 238, 0.4), transparent 60%),
    var(--surface-2);
}

.portfolio__thumb--kova {
  --thumb-a: rgba(124, 92, 255, 0.95);
  --thumb-b: rgba(34, 211, 238, 0.8);
  background:
    linear-gradient(135deg, rgba(124, 92, 255, 0.5) 0%, rgba(34, 211, 238, 0.28) 100%),
    var(--surface-2);
}

.portfolio__thumb--nimbus {
  --thumb-a: rgba(34, 211, 238, 0.9);
  --thumb-b: rgba(124, 92, 255, 0.7);
  background:
    linear-gradient(180deg, rgba(34, 211, 238, 0.42) 0%, transparent 70%),
    radial-gradient(90% 70% at 80% 100%, rgba(124, 92, 255, 0.4), transparent 65%),
    var(--surface-2);
}

.portfolio__thumb--verde {
  --thumb-a: rgba(34, 211, 238, 0.85);
  --thumb-b: rgba(244, 114, 182, 0.65);
  background:
    conic-gradient(from 210deg at 70% 30%, rgba(34, 211, 238, 0.4), rgba(124, 92, 255, 0.18), rgba(244, 114, 182, 0.32), rgba(34, 211, 238, 0.4)),
    var(--surface-2);
}

.portfolio__thumb--lumen {
  --thumb-a: rgba(124, 92, 255, 0.95);
  --thumb-b: rgba(244, 114, 182, 0.7);
  background:
    linear-gradient(160deg, rgba(124, 92, 255, 0.5) 0%, rgba(244, 114, 182, 0.22) 100%),
    var(--surface-2);
}

.portfolio__browser {
  position: absolute;
  z-index: 1;
  top: 11%;
  left: 8%;
  right: 8%;
  bottom: -6%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-alt);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  transform-origin: 50% 0;
  transition: transform 0.6s var(--ease);
}

.portfolio__card:hover .portfolio__browser,
.portfolio__card:focus-within .portfolio__browser {
  transform: translateY(-3%) scale(1.06);
}

.portfolio__bar {
  display: flex;
  flex: none;
  align-items: center;
  gap: 4px;
  height: 18px;
  padding-inline: 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.portfolio__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.portfolio__dot:nth-child(2) { background: var(--warning); }
.portfolio__dot:nth-child(3) { background: var(--success); }

.portfolio__url {
  flex: 0 1 45%;
  height: 6px;
  margin-inline: auto;
  border-radius: var(--radius-full);
  background: var(--border);
}

/* Shared mockup pieces */
.portfolio__screen {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 10px 12px 18px;
}

.portfolio__line {
  display: block;
  flex: none;
  width: 100%;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--border-strong);
}
.portfolio__line--xs { width: 9%; }
.portfolio__line--sm { width: 45%; }
.portfolio__line--md { width: 65%; }
.portfolio__line--lg { width: 85%; }
.portfolio__line--title {
  height: 7px;
  background: var(--text);
  opacity: 0.7;
}

.portfolio__logo {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--thumb-a), var(--thumb-b));
}

.portfolio__pill {
  flex: none;
  width: 16%;
  height: 9px;
  margin-left: auto;
  border-radius: var(--radius-full);
  background: var(--thumb-a);
}
.portfolio__pill--cta {
  width: 36%;
  height: 11px;
  margin: 4px 0 0;
}

.portfolio__nav {
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
}

/* Landing layout */
.portfolio__hero {
  display: grid;
  flex: 1;
  grid-template-columns: 1.1fr 1fr;
  align-items: center;
  gap: 10px;
  min-height: 0;
}

.portfolio__copy {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.portfolio__media {
  position: relative;
  display: block;
  height: 100%;
  min-height: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--thumb-a), var(--thumb-b));
  opacity: 0.85;
  overflow: hidden;
}
.portfolio__media::after {
  content: "";
  position: absolute;
  right: 12%;
  bottom: 14%;
  width: 42%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--border-strong);
  box-shadow: 0 0 0 8px var(--border);
}

.portfolio__tiles {
  display: grid;
  flex: 0 0 22%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.portfolio__tile {
  position: relative;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.portfolio__tile::before {
  content: "";
  position: absolute;
  top: 22%;
  left: 12%;
  width: 22%;
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--thumb-b);
  opacity: 0.8;
}

/* Dashboard layout */
.portfolio__screen--dashboard {
  flex-direction: row;
  gap: 0;
  padding: 0;
}

.portfolio__side {
  display: flex;
  flex: 0 0 22%;
  flex-direction: column;
  gap: 7px;
  padding: 10px 8px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.portfolio__side .portfolio__logo { margin-bottom: 4px; }

.portfolio__main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 10px 10px 18px;
}

.portfolio__kpis {
  display: grid;
  flex: 0 0 24%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.portfolio__kpi {
  position: relative;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.portfolio__kpi::before {
  content: "";
  position: absolute;
  left: 12%;
  bottom: 28%;
  width: 50%;
  height: 5px;
  border-radius: var(--radius-full);
  background: var(--thumb-a);
}
.portfolio__kpi:nth-child(2)::before { width: 35%; background: var(--thumb-b); }
.portfolio__kpi:nth-child(3)::before { width: 62%; }

.portfolio__chart {
  display: flex;
  flex: 1;
  align-items: flex-end;
  gap: 6%;
  min-height: 0;
  padding: 10px 10px 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background:
    repeating-linear-gradient(to top, var(--border) 0 1px, transparent 1px 25%),
    var(--surface);
}

.portfolio__col {
  flex: 1;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(to top, var(--thumb-b), var(--thumb-a));
  transform-origin: 50% 100%;
  transition: transform 0.6s var(--ease);
}
.portfolio__col:nth-child(1) { height: 30%; }
.portfolio__col:nth-child(2) { height: 42%; }
.portfolio__col:nth-child(3) { height: 36%; }
.portfolio__col:nth-child(4) { height: 55%; }
.portfolio__col:nth-child(5) { height: 62%; }
.portfolio__col:nth-child(6) { height: 78%; }
.portfolio__col:nth-child(7) { height: 94%; }

.portfolio__card:hover .portfolio__col { transform: scaleY(1.06); }

/* Grid (blog / shop) layout */
.portfolio__cards {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-height: 0;
}

.portfolio__mini {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  padding: 4px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.portfolio__mini-img {
  flex: 1;
  min-height: 0;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--thumb-a), var(--thumb-b));
  opacity: 0.8;
}
.portfolio__mini:nth-child(2) .portfolio__mini-img { opacity: 0.55; }
.portfolio__mini:nth-child(3) .portfolio__mini-img { background: linear-gradient(135deg, var(--thumb-b), var(--thumb-a)); }
.portfolio__mini:nth-child(4) .portfolio__mini-img { opacity: 0.6; background: linear-gradient(135deg, var(--thumb-b), var(--thumb-a)); }
.portfolio__mini:nth-child(5) .portfolio__mini-img { opacity: 0.95; }
.portfolio__mini:nth-child(6) .portfolio__mini-img { opacity: 0.45; }
.portfolio__mini .portfolio__line { height: 3px; }

/* Card body -------------------------------------------------------------- */
.portfolio__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: var(--space-5) var(--space-5) var(--space-6);
}

.portfolio__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--space-4);
}

.portfolio__tag--industry {
  display: inline-block;
  padding: 3px 11px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
}

.portfolio__client {
  margin-bottom: var(--space-2);
  font-size: var(--fs-xl);
  font-weight: 700;
}

.portfolio__desc {
  margin-bottom: var(--space-5);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* Highlighted result metric */
.portfolio__result {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: auto 0 0;
  padding: var(--space-3) var(--space-4);
  background: var(--gradient-soft);
  border: 1px solid rgba(124, 92, 255, 0.28);
  border-radius: var(--radius);
}

.portfolio__result-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--secondary);
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.25);
}
.portfolio__result-icon svg { width: 20px; height: 20px; }

.portfolio__result-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.portfolio__result-value {
  font-family: var(--font-heading);
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.portfolio__result-label {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-muted);
}

/* CTA -------------------------------------------------------------------- */
.portfolio__cta {
  margin-top: var(--space-7);
  text-align: center;
}

.portfolio__cta-btn svg {
  width: 18px;
  height: 18px;
  transition: transform 0.25s var(--ease);
}
.portfolio__cta-btn:hover svg { transform: translateX(4px); }

/* Reduced motion --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .portfolio__card:hover .portfolio__browser,
  .portfolio__card:focus-within .portfolio__browser,
  .portfolio__card:hover .portfolio__col { transform: none; }
  .portfolio__item.is-hiding { transform: none; }
}
