/* ============================================================
   WaveLocal — Portfolio filter + grid
   File: css/portfolio-grid.css   (load AFTER portfolio.css)

   Self-contained: scoped to .portfolio-grid-section / .pf-* so it
   won't disturb the rest of the site. Uses the site's blue accent
   (#43B7FF) with a variable so a future global refactor can override it.
   ============================================================ */

.portfolio-grid-section {
  --pf-accent: var(--wl-accent, #2fa4e7);
  --pf-accent-strong: var(--wl-accent-strong, #1b6fb3);
  --pf-owned: var(--wl-premium, #6a4bc4);
  --pf-ink: #16202e;
  --pf-body: #4a5568;
  --pf-muted: #7b8794;
  --pf-card: #fff;
  --pf-line: #e6ebf1;
  --pf-radius: 16px;
  --pf-shadow: 0 1px 2px rgba(20,30,50,.04), 0 10px 30px rgba(20,30,50,.07);
  --pf-shadow-hover: 0 6px 14px rgba(20,30,50,.08), 0 22px 48px rgba(20,30,50,.14);

  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem 1.25rem 3.5rem;
}

.portfolio-lede {
  max-width: 620px;
  margin: .75rem auto 0;
  text-align: center;
  color: var(--pf-body);
  line-height: 1.6;
}

/* ---------- Filter bar ---------- */
.pf-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .6rem;
  margin: 2rem 0 2.25rem;
}

.pf-filter {
  appearance: none;
  border: 1.5px solid var(--pf-line);
  background: #fff;
  color: var(--pf-body);
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  padding: .55rem 1.15rem;
  border-radius: 999px;
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s, transform .12s, box-shadow .18s;
}

.pf-filter:hover {
  border-color: var(--pf-accent);
  color: var(--pf-accent-strong);
  transform: translateY(-1px);
}

.pf-filter.is-active {
  background: var(--pf-accent);
  border-color: var(--pf-accent);
  color: #fff;
  box-shadow: 0 6px 16px rgba(47,164,231,.35);
}

/* ---------- Grid ---------- */
.pf-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 720px) {
  .pf-grid { grid-template-columns: 1fr; }
}

/* ---------- Card ---------- */
.pf-card {
  background: var(--pf-card);
  border: 1px solid var(--pf-line);
  border-radius: var(--pf-radius);
  overflow: hidden;
  box-shadow: var(--pf-shadow);
  transition: transform .22s ease, box-shadow .22s ease, opacity .25s ease;
  opacity: 1;
}

.pf-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--pf-shadow-hover);
}

/* filter fade-out */
.pf-card.is-hidden {
  opacity: 0;
  transform: scale(.97);
  pointer-events: none;
}

/* ---------- Media ---------- */
.pf-card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #f2f5f8;
}

.pf-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s ease;
}

.pf-card:hover .pf-card-media img { transform: scale(1.05); }

/* ownership badge */
.pf-badge {
  position: absolute;
  top: .8rem;
  left: .8rem;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .3rem .7rem;
  border-radius: 999px;
  color: #fff;
  backdrop-filter: blur(4px);
}

.pf-badge--client { background: rgba(27,111,179,.92); }
.pf-badge--owned  { background: rgba(106,75,196,.92); }

/* ---------- Body ---------- */
.pf-card-body { padding: 1.4rem 1.4rem 1.6rem; }

.pf-card-title {
  margin: 0 0 .3rem;
  font-size: 1.3rem;
  color: var(--pf-ink);
  line-height: 1.2;
}

.pf-card-url {
  margin: 0 0 .9rem;
  font-size: .88rem;
}

.pf-card-url a { color: var(--pf-accent-strong); text-decoration: none; font-weight: 600; }
.pf-card-url a:hover { text-decoration: underline; }

.pf-url-note {
  display: inline-block;
  margin-left: .5rem;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #b8860b;
  background: #fff6e0;
  padding: .12rem .5rem;
  border-radius: 4px;
}

.pf-card-overview {
  margin: 0 0 1.1rem;
  color: var(--pf-body);
  font-size: .95rem;
  line-height: 1.55;
}

/* ---------- Toggle ---------- */
.pf-toggle {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  color: var(--pf-accent-strong);
  font: inherit;
  font-weight: 700;
  font-size: .9rem;
}

.pf-chevron { transition: transform .22s ease; }
.pf-card.is-open .pf-chevron { transform: rotate(180deg); }

/* ---------- Detail ---------- */
.pf-detail {
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--pf-line);
  animation: pf-fade .28s ease;
}

@keyframes pf-fade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.pf-detail h3 {
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--pf-muted);
  margin: 0 0 .5rem;
}

.pf-detail h3 + ul { margin: 0 0 1.1rem; }

.pf-detail ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1.1rem;
}

.pf-detail li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: .5rem;
  color: var(--pf-body);
  font-size: .92rem;
  line-height: 1.45;
}

.pf-detail li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .5em;
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: var(--pf-accent);
}

.pf-detail p {
  margin: 0;
  color: var(--pf-body);
  font-size: .95rem;
  line-height: 1.6;
}

.pf-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--pf-muted);
  padding: 2rem 0;
}

@media (prefers-reduced-motion: reduce) {
  .pf-card, .pf-card-media img, .pf-chevron, .pf-filter { transition: none; }
  .pf-detail { animation: none; }
}

/* ============================================================
   Intro band — sits on white below the hero, always readable.
   ============================================================ */
.portfolio-intro-band {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem 1.25rem 0;
}
.portfolio-intro-band .portfolio-lede {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  color: #4a5568;
  font-size: 1.05rem;
  line-height: 1.6;
}

/* ============================================================
   DARK MODE
   Site toggles `body.dark-mode` (see js/app.js). Mirror the
   portfolio surfaces so cards don't glare white in dark mode.
   ============================================================ */
body.dark-mode .portfolio-grid-section {
  --pf-ink: #f2f6fb;
  --pf-body: #c3ccd6;
  --pf-muted: #93a1b0;
  --pf-card: #16202c;
  --pf-line: #2a3644;
  --pf-shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  --pf-shadow-hover: 0 6px 14px rgba(0,0,0,.4), 0 22px 48px rgba(0,0,0,.5);
}

body.dark-mode .portfolio-intro-band .portfolio-lede { color: #c3ccd6; }

body.dark-mode .pf-filter {
  background: #16202c;
  border-color: #2a3644;
  color: #c3ccd6;
}
body.dark-mode .pf-filter:hover {
  border-color: var(--pf-accent);
  color: #fff;
}
body.dark-mode .pf-filter.is-active {
  background: var(--pf-accent);
  border-color: var(--pf-accent);
  color: #fff;
}

/* ============================================================
   Mobile: filters become a single horizontal scroll row instead
   of wrapping onto multiple lines. Cleaner and more app-like on
   narrow screens.
   ============================================================ */
@media (max-width: 640px) {
  .pf-filters {
    flex-wrap: nowrap;             /* stop wrapping to a 2nd row */
    justify-content: flex-start;   /* start from the left, not centred */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    /* bleed to screen edges + padding so the first/last pill aren't
       jammed against the edge and there's a hint of scroll room */
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    padding: 0 1.25rem;
    scroll-padding-left: 1.25rem;
  }

  /* hide the scrollbar but keep it scrollable */
  .pf-filters::-webkit-scrollbar { display: none; }
  .pf-filters { scrollbar-width: none; }

  .pf-filter {
    flex: 0 0 auto;                /* don't shrink; keep label on one line */
    scroll-snap-align: start;
    white-space: nowrap;
  }
}

/* ============================================================
   Container override.
   The site's base .container is max-width:380px (built for the old
   narrow mobile layout). Our portfolio content sets its own widths,
   so neutralise the container's width constraint here — its only
   remaining job on this page is to be the element toggleNav() targets
   with .clicked when the mobile menu opens.
   ============================================================ */
.portfolio-page-container {
  max-width: none;
  padding: 0;
}
/* Preserve the mobile-menu behaviour: when the menu is open the site
   expects the container full-width, which we already are. */
