/* Portfolio page */

/* ---- Hero with floating phones ---- */
.pf-hero {
  position: relative; overflow: hidden; color: #fff; padding: 96px 0 120px;
  background: var(--navy);
}
.pf-hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1.15fr 1fr; gap: 48px; align-items: center; }
.pf-hero h1 { font-size: clamp(40px, 6vw, 72px); font-weight: 800; margin-bottom: 20px; }
.pf-hero .lead { color: #d6d3cc; font-size: clamp(17px, 2vw, 19px); max-width: 560px; margin-bottom: 40px; }

/* rotating word */
.pf-rotator { display: inline-grid; vertical-align: bottom; overflow: hidden; height: 1.15em; }
.pf-rotator b {
  grid-area: 1 / 1; font-weight: 800; transform: translateY(110%); opacity: 0;
  transition: transform .6s cubic-bezier(.2,.8,.2,1), opacity .6s;
  color: var(--accent);
}
.pf-rotator b.on { transform: none; opacity: 1; }
.pf-rotator b.out { transform: translateY(-110%); opacity: 0; }

.pf-hero-stats { display: flex; gap: 40px; flex-wrap: wrap; }
.pf-hero-stats strong { display: block; font-size: 36px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.pf-hero-stats span { color: #a19f98; font-size: 14px; }

.pf-phones { position: relative; height: 460px; perspective: 1200px; }
.pf-phone {
  position: absolute; width: 196px; aspect-ratio: 9 / 18.5; border-radius: 34px; padding: 9px;
  background: #2b2d31; box-shadow: 0 30px 60px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.08);
  animation: pf-float 7s ease-in-out infinite;
}
.pf-phone::before { content: ""; position: absolute; top: 15px; left: 50%; width: 56px; height: 6px; margin-left: -28px; border-radius: 9px; background: #0d0e10; z-index: 2; }
.pf-screen { position: relative; height: 100%; border-radius: 26px; overflow: hidden; background: #000; }
.pf-screen img { position: relative; width: 100%; height: 100%; object-fit: contain; }
.pf-phone-0 { left: 34%; top: 0; z-index: 3; --r: -4deg; }
.pf-phone-1 { left: 2%; top: 80px; z-index: 2; --r: -14deg; animation-delay: -2.3s; opacity: .9; transform: scale(.88); }
.pf-phone-2 { right: 0; top: 96px; z-index: 1; --r: 10deg; animation-delay: -4.6s; opacity: .85; }
@keyframes pf-float {
  0%, 100% { translate: 0 0; rotate: var(--r); }
  50%      { translate: 0 -18px; rotate: calc(var(--r) + 2deg); }
}
.pf-orbit { display: none; position: absolute; inset: 40px 10px 0 0; border: 1px dashed rgba(255,255,255,.12); border-radius: 50%; animation: pf-spin 40s linear infinite; }
.pf-orbit::before { content: ""; position: absolute; top: 12%; left: 8%; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 24px 6px rgba(5,193,254,.6); }
@keyframes pf-spin { to { rotate: 360deg; } }

/* ---- Toolbar ---- */
.pf-main { padding-top: 0; }
.pf-toolbar {
  position: sticky; top: 84px; z-index: 20; margin: -36px 0 40px; padding: 12px;
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: nowrap;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 18px rgba(20,20,18,.06);
}
.pf-filters { display: flex; gap: 4px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.pf-filters::-webkit-scrollbar { display: none; }
.pf-filters { -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent); mask-image: linear-gradient(90deg, #000 90%, transparent); padding-right: 24px; }
.pf-chip { white-space: nowrap; }
.pf-chip {
  font: 600 13.5px/1 inherit; font-family: inherit; color: var(--muted); background: transparent; border: 0; cursor: pointer;
  padding: 9px 11px; border-radius: 6px; transition: background .2s, color .2s;
}
.pf-chip span { font-weight: 500; font-size: 12px; margin-left: 4px; padding: 2px 7px; border-radius: 99px; background: var(--bg-soft); }
.pf-chip:hover { color: var(--text); background: var(--bg-soft); }
.pf-chip.active { background: var(--navy); color: #fff; }
.pf-chip.active span { background: rgba(255,255,255,.15); }
.pf-search { position: relative; flex: 0 0 220px; }
.pf-search i { position: absolute; left: 14px; top: 50%; translate: 0 -50%; color: #a19f98; }
.pf-search input { width: 100%; font: inherit; font-size: 15px; padding: 10px 14px 10px 38px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.pf-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(5,193,254,.15); }

/* ---- Cards ---- */
.pf-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.pf-card { transition: opacity .35s, transform .35s; }
.pf-card.is-hidden { display: none; }
.pf-card-btn {
  --mx: 50%; --my: 50%; --rx: 0deg; --ry: 0deg;
  position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; text-align: left; cursor: pointer;
  font: inherit; color: inherit; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s;
}
.pf-card-btn::after { /* glow that follows the cursor */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  display: none; /* no cursor glow */
}
.pf-card-btn:hover, .pf-card-btn:focus-visible { border-color: #cfc9be; box-shadow: 0 14px 30px rgba(20,20,18,.08); }
.pf-card-btn:hover::after { opacity: 1; }
.pf-card-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.pf-visual { position: relative; aspect-ratio: 5 / 4; overflow: hidden; background: var(--bg-soft); }
.pf-blur { position: absolute; inset: -24px; background: center / cover; filter: blur(22px) saturate(1.3); opacity: .55; }
.pf-visual img { position: relative; width: 100%; height: 100%; object-fit: contain; transition: transform .5s cubic-bezier(.2,.8,.2,1); }
.pf-card-btn:hover .pf-visual img { transform: scale(1.06); }
.pf-placeholder {
  height: 100%; display: grid; place-items: center; font-size: 56px; font-weight: 800; letter-spacing: -.04em; color: #fff;
  background: var(--navy); color: var(--accent) !important;
}
.pf-tag {
  position: absolute; left: 12px; top: 12px; z-index: 1; font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 4px;
  background: #fff; color: var(--text); border: 1px solid var(--line);
}
.pf-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.pf-body h2 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.pf-body p { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 0 0 16px; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pf-more { font-size: 14px; font-weight: 600; color: var(--accent-dark); display: inline-flex; gap: 8px; align-items: center; }
.pf-more i { transition: transform .25s; }
.pf-card-btn:hover .pf-more i { transform: translateX(4px); }
.pf-empty { text-align: center; color: var(--muted); padding: 48px 0; font-size: 17px; }

/* filter animation */
.pf-card.pf-enter { animation: pf-pop .45s cubic-bezier(.2,.8,.2,1) both; }
@keyframes pf-pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }

/* ---- Detail dialog ---- */
.pf-dialog {
  width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 12px; overflow: hidden;
  box-shadow: 0 40px 120px rgba(0,0,0,.4); color: var(--text);
}
.pf-dialog[open] { display: grid; grid-template-columns: 1fr 1.1fr; animation: pf-dialog-in .35s cubic-bezier(.2,.8,.2,1); }
.pf-dialog::backdrop { background: rgba(22,24,27,.7); }
@keyframes pf-dialog-in { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.pf-d-visual { position: relative; min-height: 320px; overflow: hidden; background: var(--navy); display: grid; place-items: center; }
.pf-d-visual .pf-blur { opacity: .5; }
.pf-d-visual img { position: relative; max-width: 86%; max-height: 420px; object-fit: contain; border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.pf-d-visual .pf-placeholder { position: absolute; inset: 0; font-size: 96px; }
.pf-d-body { padding: 40px 36px 32px; overflow-y: auto; max-height: calc(100vh - 48px); }
.pf-d-tag { position: static; display: inline-block; background: #e2f3fa; color: var(--accent-dark); margin-bottom: 14px; }
.pf-d-body h2 { font-size: clamp(24px, 3vw, 30px); }
.pf-d-desc { color: var(--muted); font-size: 15.5px; margin-bottom: 28px; }
.pf-d-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-ghost-dark { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn-ghost-dark:hover { background: var(--bg-soft); }
.pf-close {
  position: absolute; top: 14px; right: 14px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.9); color: var(--text); font-size: 16px; box-shadow: var(--shadow);
}
.pf-close:hover { background: #fff; }

/* ---- Responsive ---- */
@media (max-width: 1100px) { .pf-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 980px) {
  .pf-hero-grid { grid-template-columns: 1fr; }
  .pf-phones { height: 380px; max-width: 480px; width: 100%; margin: 0 auto; }
  .pf-phone { width: 160px; }
  .pf-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .pf-hero { padding: 64px 0 96px; }
  .pf-phones { display: none; }
  .pf-hero-stats { gap: 24px; flex-wrap: nowrap; }
  .pf-hero-stats strong { font-size: 28px; }
  .pf-hero-stats span { font-size: 13px; }
  .pf-toolbar { top: 80px; flex-direction: column; align-items: stretch; }
  .pf-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .pf-filters::-webkit-scrollbar { display: none; }
  .pf-chip { white-space: nowrap; }
  .pf-search { flex: 1 1 auto; }
  .pf-dialog[open] { grid-template-columns: 1fr; overflow-y: auto; }
  .pf-d-visual { min-height: 240px; }
  .pf-d-visual img { max-height: 260px; }
  .pf-d-body { max-height: none; padding: 28px 22px 24px; }
}
@media (max-width: 520px) { .pf-grid { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  .pf-phone, .pf-orbit { animation: none; }
  .pf-rotator b { transition: none; }
  .pf-card, .pf-card-btn, .pf-visual img, .pf-card.pf-enter, .pf-dialog[open] { animation: none; transition: none; }
}

.pf-placeholder { grid-template-rows: auto auto; align-content: center; gap: 10px; }
.pf-placeholder i { font-size: 44px; color: var(--accent); }
.pf-placeholder span { font-size: 15px; font-weight: 700; letter-spacing: .12em; color: #a19f98; }
