/* ════════════════════════════════════════════════════════════════
   PortfolioSection — shared base styles for portfolio.html and
   archive.html. All rules scoped under .pf-section so nothing leaks
   into the rest of the site.
   ════════════════════════════════════════════════════════════════ */
.pf-section {
  /* tokens */
  --pf-bg:        #F8F8F6;
  --pf-accent:    #0047FF;
  --pf-text:      #111111;
  --pf-text-2:    #777772;
  --pf-tag-bg:    #EFEFEA;
  --pf-tag-text:  #56564F;
  --pf-tag-bg-h:  #DDE4FF;
  --pf-card-bg:   #FFFFFF;
  --pf-line:      #E7E7E2;
  --pf-radius:    16px;

  box-sizing: border-box;
  background: var(--pf-bg);
  color: var(--pf-text);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: clamp(40px, 6vw, 96px) clamp(24px, 6vw, 80px);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}
.pf-section *, .pf-section *::before, .pf-section *::after { box-sizing: border-box; }

.pf-inner { max-width: 1160px; margin: 0 auto; }

/* Fraunces display — NEVER italic. Emphasis via weight + colour only. */
.pf-display { font-family: "Fraunces", Georgia, serif; font-style: normal; font-optical-sizing: auto; }

/* ── Header ── */
.pf-header {
  position: relative;
  display: flex; flex-direction: column; gap: 8px;
  padding-bottom: 32px; border-bottom: 1px solid var(--pf-line);
}

/* Subtle background pattern behind the page title, fading out beyond
   a ~1400px-wide centred band on wider viewports. */
.pf-header-pattern::before {
  content: '';
  position: absolute;
  top: calc(-1 * clamp(40px, 6vw, 96px)); left: 50%;
  width: 100vw; height: calc(100% + clamp(40px, 6vw, 96px));
  transform: translateX(-50%);
  background-image: url("thumbs/bg-pattern.svg");
  background-repeat: repeat;
  background-position: center;
  background-size: 600px 346px;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 700px, #000 calc(100% - 700px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 700px, #000 calc(100% - 700px), transparent 100%);
  pointer-events: none;
  z-index: 0;
}
.pf-header-pattern > * { position: relative; z-index: 1; }
.pf-title {
  font-weight: 400; line-height: 1.02; letter-spacing: -0.02em;
  font-size: clamp(2.6rem, 6vw, 4.4rem); color: var(--pf-text); max-width: 12ch;
}
.pf-title b { font-weight: 600; color: var(--pf-accent); }
.pf-intro {
  text-align: left; max-width: 32ch;
  font-size: clamp(0.95rem, 1.4vw, 1.05rem); line-height: 1.5; color: var(--pf-text-2);
}

/* ── Back link ── */
.pf-back {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.9rem; font-weight: 600; color: var(--pf-text-2);
  text-decoration: none; margin-bottom: 16px;
  transition: color .18s ease;
}
.pf-back:hover { color: var(--pf-accent); }
.pf-back:focus-visible { outline: 2px solid var(--pf-accent); outline-offset: 2px; }

/* ── Filter control ── */
/* Temporarily hidden — re-enable by removing this rule. */
.pf-filter, #pf-section-candy { display: none !important; }

.pf-filter {
  display: inline-flex; gap: 8px; margin: 32px 0 8px;
  padding: 4px; background: #FFFFFF; border: 1px solid var(--pf-line);
  border-radius: 999px;
}
.pf-filter-btn {
  font-family: inherit; font-size: 0.9rem; font-weight: 600; letter-spacing: 0.01em;
  color: var(--pf-text); background: transparent; border: 0;
  padding: 8px 16px; border-radius: 999px; cursor: pointer;
  transition: background-color .18s ease, color .18s ease;
}
.pf-filter-btn:hover { background: var(--pf-tag-bg); }
.pf-filter-btn.pf-active { background: var(--pf-text); color: #FFFFFF; }
.pf-filter-btn:focus-visible { outline: 2px solid var(--pf-accent); outline-offset: 2px; }

/* ── Section headings ── */
.pf-section-block { margin-top: clamp(48px, 6vw, 72px); }
.pf-section-head { margin-bottom: 24px; }
.pf-section-title {
  font-weight: 400; font-size: clamp(1.5rem, 2.6vw, 2rem);
  letter-spacing: -0.01em; color: var(--pf-text);
}
.pf-section-sub { margin-top: 4px; font-size: 0.98rem; color: var(--pf-text-2); }

/* ── Case-study cards (horizontal) ── */
.pf-cases-grid {
  display: grid; gap: 24px;
  grid-template-columns: 1fr;
}
.pf-case-card {
  display: flex; align-items: center; gap: 0; overflow: hidden; text-align: left;
  background: var(--pf-card-bg); border: 1px solid var(--pf-line);
  border-radius: var(--pf-radius); cursor: pointer;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.pf-case-card:hover, .pf-case-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px -16px rgba(17,17,17,0.28);
  border-color: transparent; outline: none;
}
.pf-case-thumb {
  flex: 0 0 42%; max-width: 480px; aspect-ratio: 16 / 9; overflow: hidden;
  background: color-mix(in srgb, var(--accent) 12%, #fff);
  border-right: 1px solid var(--pf-line);
}
.pf-case-img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .3s ease;
}
.pf-case-card:hover .pf-case-img { transform: scale(1.03); }
.pf-case-body { padding: 24px; display: flex; flex-direction: column; gap: 8px; }
.pf-card-title { font-weight: 600; font-size: 1.22rem; letter-spacing: -0.01em; line-height: 1.15; }
.pf-card-summary {
  font-size: 0.94rem; line-height: 1.55; color: var(--pf-text-2);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden;
}
.pf-card-cue {
  margin-top: auto; font-weight: 600; font-size: 0.88rem; color: var(--pf-accent);
  transition: gap .2s ease;
}

/* ── Tags ── */
.pf-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-tag {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.01em;
  padding: 4px 12px; border-radius: 999px;
  background: var(--pf-tag-bg); color: var(--pf-tag-text);
  transition: background-color .2s ease, color .2s ease;
}
.pf-case-card:hover .pf-tag { background: var(--pf-tag-bg-h); color: var(--pf-accent); }

/* ── Eye-candy grid (asymmetric) ── */
.pf-candy-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 192px;
}
.pf-candy-tile {
  position: relative; overflow: hidden; margin: 0;
  border-radius: var(--pf-radius); background: var(--accent);
  cursor: pointer;
}
.pf-candy-tile.pf-feature { grid-row: span 2; }
.pf-candy-img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .35s ease;
}
.pf-candy-tile:hover .pf-candy-img { transform: scale(1.04); }
.pf-candy-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 2px;
  padding: 16px; color: #fff;
  background: linear-gradient(to top, rgba(10,10,12,0.78) 0%, rgba(10,10,12,0.25) 38%, rgba(10,10,12,0) 62%);
  opacity: 0; transition: opacity .25s ease;
}
.pf-candy-tile:hover .pf-candy-overlay,
.pf-candy-tile:focus-within .pf-candy-overlay { opacity: 1; }
.pf-candy-name { font-family: "Fraunces", Georgia, serif; font-style: normal; font-weight: 500; font-size: 1.15rem; }
.pf-candy-kind { font-size: 0.8rem; font-weight: 500; color: rgba(255,255,255,0.8); }

/* ── PDF modal ── */
.pf-modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  display: none; align-items: center; justify-content: center;
  padding: clamp(16px, 4vw, 48px);
  background: rgba(17,17,17,0.62); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.pf-modal-backdrop.pf-open { display: flex; }
.pf-modal {
  width: min(960px, 100%); height: min(88vh, 1000px);
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: 16px; box-shadow: 0 40px 80px -16px rgba(0,0,0,0.5);
}
.pf-modal-bar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 16px; border-bottom: 1px solid var(--pf-line);
}
.pf-modal-title {
  font-family: "Fraunces", Georgia, serif; font-style: normal; font-weight: 500;
  font-size: 1.05rem; margin-right: auto;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pf-modal-action {
  font-family: inherit; font-size: 0.85rem; font-weight: 600; text-decoration: none;
  color: var(--pf-text); background: var(--pf-tag-bg);
  padding: 8px 16px; border-radius: 8px; border: 0; cursor: pointer;
  transition: background-color .18s ease, color .18s ease;
}
.pf-modal-action:hover { background: var(--pf-tag-bg-h); color: var(--pf-accent); }
.pf-modal-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; font-size: 1.2rem; line-height: 1;
  color: var(--pf-text); background: var(--pf-tag-bg); border: 0;
  border-radius: 8px; cursor: pointer; transition: background-color .18s ease;
}
.pf-modal-close:hover { background: #E2E2DC; }
.pf-modal-action:focus-visible, .pf-modal-close:focus-visible {
  outline: 2px solid var(--pf-accent); outline-offset: 2px;
}
.pf-modal-frame { flex: 1; width: 100%; border: 0; background: #525659; }

/* ── Responsive ── */
@media (max-width: 820px) {
  .pf-cases-grid { grid-template-columns: 1fr; }
  .pf-candy-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 168px; }
  .pf-header-pattern::before {
    -webkit-mask-image: none;
    mask-image: none;
  }
}
@media (max-width: 560px) {
  .pf-case-card { flex-direction: column; align-items: stretch; }
  .pf-case-thumb { flex-basis: auto; max-width: none; width: 100%; aspect-ratio: 16 / 9; border-right: 0; border-bottom: 1px solid var(--pf-line); }
  .pf-candy-grid { grid-template-columns: 1fr; grid-auto-rows: 192px; }
  .pf-candy-tile.pf-feature { grid-row: span 1; }
}

/* ── Reduced motion: kill transforms/scale ── */
@media (prefers-reduced-motion: reduce) {
  .pf-section * { transition: none !important; }
  .pf-case-card:hover, .pf-case-card:focus-visible { transform: none; }
  .pf-case-card:hover .pf-case-img,
  .pf-candy-tile:hover .pf-candy-img,
  .pf-archive-card:hover .pf-archive-img { transform: none; }
}
