/* Option C projects page: Grid / List / Gallery views and the project view */
.work-page {
  --ease: cubic-bezier(.17, .84, .44, 1);
}
/* Heading, filters and page width are Option B's (styles.css .page-head.plain / .projects-index) */
.work-page .projects-index { padding-bottom: 120px; } /* room for the view switch */
.wk-body { scroll-margin-top: calc(var(--nav-h) + 16px); }

/* Photos fade in once loaded */
.wk-view:not(.project-grid) img, .pv img { opacity: 0; transition: opacity .6s var(--ease), transform 1.1s var(--ease); }
.wk-view:not(.project-grid) img.ld, .pv img.ld { opacity: 1; }

/* Items rise in as they come into view */
.pj, .l-row, .ga-item { opacity: 0; transform: translateY(40px); transition: opacity .9s var(--ease) var(--d, 0ms), transform .9s var(--ease) var(--d, 0ms); }
.pj.in, .l-row.in, .ga-item.in { opacity: 1; transform: none; }

/* ---------- Grid: Option B's project grid (styles.css .project-grid / .pj / .pd) ---------- */

/* ---------- List: one row per project with its photo strip ---------- */
.wk-list { border-top: 1px solid var(--line); }
.l-row { display: grid; grid-template-columns: 56px minmax(220px, 1fr) minmax(0, 1.6fr); gap: 24px; align-items: center; padding: 22px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: opacity .9s var(--ease), transform .9s var(--ease), color .3s; }
.l-n { font-family: var(--head); font-size: .85rem; color: var(--muted); align-self: start; padding-top: .5rem; }
.l-title h2 { font-size: clamp(1.15rem, 1.8vw, 1.4rem); }
.l-title p { font-size: .88rem; color: var(--muted); margin-top: 8px; line-height: 1.4; }
.l-strip { display: flex; gap: 8px; height: 120px; overflow: hidden; scroll-behavior: auto; }
.l-strip img { height: 100%; width: auto; flex: none; }
@media (hover: hover) and (pointer: fine) {
  .wk-list:hover .l-row.in { opacity: .35; }
  .wk-list .l-row.in:hover { opacity: 1; }
  .l-row:hover .l-title h2 { font-style: italic; }
}

/* ---------- Gallery: every photo ---------- */
/* An endless canvas filling the screen under the menu; work.js places and moves every photo */
html.ga-mode, html.ga-mode body { overflow: hidden; overscroll-behavior: none; }
html.ga-mode .page-head, html.ga-mode .projects-index .browse, html.ga-mode .projects-index .filters, html.ga-mode .no-results, html.ga-mode .footer { display: none; }
html.ga-mode .work-page .projects-index { padding: 0; }
.wk-gallery { position: fixed; left: 0; right: 0; top: var(--nav-h); bottom: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.wk-gallery.dragging { cursor: grabbing; }
.wk-gallery.dragging .ga-item { pointer-events: none; }
.wk-gallery .ga-item { position: absolute; left: 0; top: 0; visibility: hidden; opacity: 1; transform: none; transition: opacity .5s var(--ease); will-change: transform; -webkit-user-drag: none; }
.wk-gallery .ga-item img { width: 100%; height: 100%; object-fit: cover; -webkit-user-drag: none; }
.ga-item { position: relative; display: block; overflow: hidden; background: var(--tint); color: #fff; text-decoration: none; }
.ga-item img { width: 100%; height: auto; }
.ga-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 14px 12px; font-family: var(--head); font-size: .9rem; font-weight: 500; background: linear-gradient(transparent, rgba(0,0,0,.55)); opacity: 0; transform: translateY(8px); transition: opacity .4s var(--ease), transform .4s var(--ease); }
@media (hover: hover) and (pointer: fine) {
  .ga-item:hover img { transform: scale(1.035); }
  .ga-item:hover .ga-cap { opacity: 1; transform: none; }
  /* same as the list view: the pointed-at project stays bright, the rest fade back */
  .wk-gallery.hovering .ga-item.in { opacity: .35; }
  .wk-gallery.hovering .ga-item.in.hl { opacity: 1; }
}
@media (hover: none), (pointer: coarse) {
  .ga-cap { display: none; }   /* no pointer to hover with: a tap opens the project */
}

/* ---------- Grid / List / Gallery switch ---------- */
.wk-switch { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60; display: flex; gap: 2px; padding: 4px; border-radius: 999px; background: var(--nav-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 0 0 1px var(--line), 0 10px 30px -12px rgba(0,0,0,.3); }
.wk-switch button { display: flex; align-items: center; gap: 8px; border: 0; background: none; color: var(--muted); padding: 9px 16px; border-radius: 999px; cursor: pointer; font-family: var(--head); font-size: .88rem; font-weight: 500; transition: background .25s, color .25s; }
.wk-switch svg { width: 13px; height: 13px; fill: currentColor; }
.wk-switch button:hover { color: var(--ink); }
.wk-switch button.active { background: var(--ink); color: var(--on-ink); }
.pv-lock .wk-switch { opacity: 0; pointer-events: none; }

/* ---------- Project view ---------- */
html.pv-lock, html.pv-lock body { overflow: hidden; }
.pv { --ease: cubic-bezier(.17, .84, .44, 1); position: fixed; inset: 0; z-index: 200; background: var(--bg); color: var(--ink); display: flex; flex-direction: column; visibility: hidden; opacity: 0; transform: translateY(24px); transition: opacity .45s var(--ease), transform .6s var(--ease), visibility 0s .6s; }
.pv.open { visibility: visible; opacity: 1; transform: none; transition: opacity .45s var(--ease), transform .6s var(--ease), visibility 0s; }
.pv-bar { display: flex; align-items: center; gap: 28px; height: 64px; padding: 0 40px; border-bottom: 1px solid var(--line); flex: none; }
.pv-bar button { background: none; border: 0; color: var(--ink); cursor: pointer; font-family: var(--head); font-size: .92rem; font-weight: 500; padding: 8px 0; }
.pv-bar button:hover span { text-decoration: underline; text-underline-offset: 4px; }
.pv-count { font-family: var(--head); font-size: .85rem; color: var(--muted); }
.pv-close { margin-left: auto; }
.pv-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.pv-inner { display: grid; grid-template-columns: minmax(260px, 1fr) 2.2fr; gap: 48px; padding: 40px; }
.pv-info { position: sticky; top: 40px; align-self: start; }
.pv-cat { font-family: var(--head); font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.pv-info h2 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); margin: 14px 0 32px; }
.pv-info dl { display: grid; gap: 0; border-top: 1px solid var(--line); }
.pv-info dl div { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: .92rem; line-height: 1.45; }
.pv-info dt { color: var(--muted); }
.pv-info dd { color: var(--ink); }
.pv-photos { display: flex; flex-direction: column; gap: 16px; }
.pv-photos figure { background: var(--tint); scroll-margin-top: 16px; }
.pv-photos img { width: 100%; height: auto; }
.pv.swap .pv-info, .pv.swap .pv-photos { animation: pv-in .7s var(--ease) both; }
.pv.swap .pv-photos { animation-delay: .08s; }
@keyframes pv-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ---------- Smaller screens ---------- */
@media (max-width: 1000px) {
  .l-row { grid-template-columns: 40px 1fr; }
  .l-strip { grid-column: 2; height: 96px; overflow-x: auto; scrollbar-width: none; }
  .l-strip::-webkit-scrollbar { display: none; }
  .pv-inner { grid-template-columns: 1fr; gap: 28px; }
  .pv-info { position: static; }
}
@media (max-width: 760px) {
  .l-row { gap: 14px; padding: 18px 0; }
  .l-strip { height: 84px; }
  .wk-switch { bottom: 14px; }
  .wk-switch button { padding: 9px 13px; }
  .pv-bar { padding: 0 16px; gap: 16px; height: 56px; }
  .pv-bar .pv-nav span, .pv-close span { display: none; }
  .pv-nav, .pv-close { font-size: 1.3rem !important; min-width: 32px; }
  .pv-inner { padding: 24px 16px 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .pj, .l-row, .ga-item { opacity: 1; transform: none; transition: none; }
  .wk-view img, .pv img { transition: opacity .2s; }
  .pv, .pv.open { transform: none; transition: opacity .2s, visibility 0s; }
  .pv.swap .pv-info, .pv.swap .pv-photos { animation: none; }
}

/* ---------- Phones: bigger buttons in the project view and the view switch ---------- */
@media (max-width: 760px) {
  .pv-bar { gap: 8px; }
  .pv-nav, .pv-close { min-width: 44px !important; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .wk-switch { bottom: max(14px, env(safe-area-inset-bottom)); }
  .wk-switch button { padding: 12px 15px; }
  .pv-info dl div { grid-template-columns: 84px 1fr; }
}
