/*
Theme Name: JW 2026
Description: Minimal portfolio theme for jakubwroblewski.com (grid of works, unified EN/PL project pages).
Version: 1.0
Text Domain: jw2026
*/

:root { --ink: #111; --muted: #555; --line: #111; --bg: #fafaf9; --pad: 40px; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.4; }
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--muted); }
img { max-width: 100%; height: auto; display: block; }
.wrap { padding: 28px var(--pad) 80px; display: flex; flex-direction: column; gap: 40px; }

/* header */
.site-head { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 40px; align-items: start; }
.site-id h1, .site-id .name { margin: 0; font-size: 22px; line-height: 1.1; font-weight: 700; letter-spacing: -0.01em; text-transform: uppercase; }
.site-id p { margin: 2px 0 0; font-size: 13px; font-weight: 700; text-transform: uppercase; }
.site-id .mail { font-size: 13px; color: #444; }
.site-nav { display: grid; grid-template-columns: repeat(3, auto); justify-content: space-between; grid-template-rows: repeat(3, auto); grid-auto-flow: column; gap: 4px 24px; font-size: 13px; font-weight: 700; }
.site-nav a { display: grid; grid-template-columns: 28px minmax(0, 1fr); }

/* section heads */
.bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; }
.bar h2 { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; }
.filters { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 13px; }
.filters button { font: inherit; color: var(--ink); background: none; border: 0; padding: 4px 0; cursor: pointer; text-transform: uppercase; }
.filters button[aria-pressed="true"] { font-weight: 700; }

/* works grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 40px 24px; }
.work { display: flex; flex-direction: column; gap: 10px; }
.work[hidden] { display: none; }
.work .pic { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #e6e6e4; }
.work .pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.work .base { filter: grayscale(1); }
.work .alt { opacity: 0; transition: opacity .3s ease; }
.work:hover .alt, .work:focus-visible .alt { opacity: 1; }
.work .base { transition: filter .3s ease; }
.work.no-alt:hover .base, .work.no-alt:focus-visible .base { filter: none; }
.work .cap { display: grid; grid-template-columns: 34px minmax(0, 1fr); column-gap: 6px; font-size: 12px; line-height: 1.3; }
.work .cap b { font-weight: 700; }
.work .cap .t { font-weight: 700; text-transform: uppercase; }
.work .cap .sub { grid-column: 2; color: var(--muted); }

/* info block */
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 40px 56px; align-items: start; }
.lang { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; display: block; margin-bottom: 10px; }
.lead { margin: 0; font-size: 15px; line-height: 1.45; }
.lead p { margin: 0 0 .8em; }
.lead + .lead { margin-top: 1em; }
.stats { display: flex; flex-direction: column; gap: 2px; font-size: 15px; font-weight: 700; text-transform: uppercase; line-height: 1.35; }
.legend { margin-top: 28px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #333; }

/* tables */
.tbl { border-top: 1px solid var(--line); font-size: 15px; }
.tbl .r { display: grid; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tbl .h { font-weight: 700; }
.tbl.meta .r { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); font-size: 14px; }
.tbl.meta .r span:first-child { font-weight: 700; text-transform: uppercase; }
.tbl.shows .r { grid-template-columns: minmax(0, 2.2fr) minmax(0, 2fr) minmax(0, 0.8fr) 60px; }
.tbl.cv .r { grid-template-columns: minmax(0, 4fr) minmax(0, 1.2fr) 60px; }
.tbl .y { font-weight: 700; }
.scroll { overflow-x: auto; }
.scroll .tbl { min-width: 640px; }

/* project */
.hero { position: relative; height: min(62vh, 56vw); min-height: 240px; overflow: hidden; background: #222; }
.hero .hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(32px) saturate(1.1); transform: scale(1.15); opacity: .9; }
.hero .hero-img { position: relative; display: block; width: 100%; height: 100%; object-fit: contain; }
.gallery:has(.span2) { grid-auto-flow: column dense; grid-template-rows: 1fr 1fr; align-items: center; }
.gallery img.span2 { grid-row: span 2; }
.gallery.eq { display: flex; }
.gallery.eq img { flex: var(--r, 1) 1 0; width: 0; min-width: 0; height: auto; }
.gallery.square img { aspect-ratio: 1 / 1 !important; object-fit: cover; }
.hero.fill .hero-img { object-fit: cover; object-position: var(--hpos, center); }
.hero.sized { height: auto; min-height: 0; background: none; }
.hero.sized .hero-bg { display: none; }
.hero.sized .hero-img { width: auto; height: auto; max-width: min(100%, var(--hmax)); max-height: var(--hmax); margin: 0 auto; }
.proj { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 40px 64px; align-items: start; }
.proj .side { display: flex; flex-direction: column; gap: 24px; }
.proj .yr { font-size: 13px; font-weight: 700; }
.proj h1 { margin: 4px 0 0; font-size: clamp(32px, 4vw, 52px); line-height: 1; font-weight: 700; letter-spacing: -0.02em; text-transform: uppercase; overflow-wrap: anywhere; }
.proj .tags { margin: 6px 0 0; font-size: 15px; color: #444; }
.proj .txt { display: flex; flex-direction: column; gap: 28px; }
.proj .txt section + section { border-top: 1px solid var(--line); padding-top: 18px; }
.proj .txt p { margin: 0 0 1em; font-size: 15px; line-height: 1.45; max-width: 68ch; }
.proj .txt p:last-child { margin-bottom: 0; }
.ext { font-weight: 700; text-transform: uppercase; font-size: 14px; }
.gallery-lead { display: flex; flex-direction: column; gap: 16px; }
.gallery-lead img { width: 100%; height: auto; cursor: zoom-in; }
.gallery-lead img.small { width: auto; max-width: min(100%, 700px); max-height: 700px; margin: 0 auto; }
.gallery img.wide { grid-column: 1 / -1; aspect-ratio: auto; height: auto; object-fit: contain; }
.gallery-lead img.tall { width: auto; max-width: 100%; max-height: 75vh; margin: 0 auto; }
.gallery-lead.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery-lead.pair img.small { width: 100%; max-width: 100%; max-height: none; }
.gallery-note { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 40px; padding: 20px 0 8px; font-size: 15px; line-height: 1.45; }
.gallery-note p { margin: 0; max-width: 68ch; }
.gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: start; }
.gallery[style*="--cols"] { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); }
@media (max-width: 800px) { .gallery, .gallery[style*="--cols"] { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.gallery.portrait { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gallery.portrait.few { grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
.gallery img { width: 100%; height: auto; cursor: zoom-in; }
.media { display: flex; flex-direction: column; gap: 16px; }
.embed { position: relative; aspect-ratio: 16 / 9; width: 100%; margin: 0 auto; background: var(--bg); }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.pager { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding-top: 14px; font-size: 14px; font-weight: 700; text-transform: uppercase; }

/* lightbox */
.lb { position: fixed; inset: 0; background: rgba(250,250,249,.98); display: none; align-items: center; justify-content: center; z-index: 50; padding: 56px 72px; }
.lb.on { display: flex; }
.lb img { max-height: 100%; max-width: 100%; width: auto; object-fit: contain; cursor: e-resize; }
.lb button { position: absolute; background: none; border: 0; font: inherit; font-size: 28px; line-height: 1; color: var(--ink, #111); cursor: pointer; padding: 12px 16px; }
.lb-prev { left: 8px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 8px; top: 50%; transform: translateY(-50%); }
.lb-x { top: 8px; right: 8px; }
.lb.one .lb-prev, .lb.one .lb-next, .lb.one .lb-bar { display: none; }
.lb-n { position: absolute; top: 20px; left: 24px; font-size: 13px; font-weight: 700; }
.lb-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0,0,0,.08); }
.lb-bar i { display: block; height: 100%; width: 0; background: #111; transition: width .25s ease; }
@media (max-width: 640px) { .lb { padding: 48px 12px; } .lb-prev, .lb-next { top: auto; bottom: 16px; transform: none; } }

/* footer */
.site-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; font-size: 13px; }

@media (max-width: 800px) {
  .site-head, .intro { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  :root { --pad: 18px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 14px; }
  .gallery-note { grid-template-columns: minmax(0, 1fr); }
  .site-nav { grid-template-columns: repeat(2, auto); grid-template-rows: repeat(5, auto); }
  /* tables: year stays visible on the right, place goes under the name */
  .scroll .tbl { min-width: 0; }
  .tbl.cv .r, .tbl.shows .r { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 14px; font-size: 14px; }
  .tbl.cv .r > span, .tbl.shows .r > span { grid-column: 1; }
  .tbl.cv .r > .y, .tbl.shows .r > .y, .tbl.cv .r.h > span:last-child, .tbl.shows .r.h > span:last-child { grid-column: 2; grid-row: 1; text-align: right; }
  .tbl.cv .r:not(.h) > span:nth-child(2), .tbl.shows .r:not(.h) > span:nth-child(2), .tbl.shows .r:not(.h) > span:nth-child(3) { color: #666; font-size: 13px; }
  .tbl.cv .r.h > span:nth-child(2), .tbl.shows .r.h > span:nth-child(2), .tbl.shows .r.h > span:nth-child(3) { display: none; }
}

/* intro on the homepage */
.intro { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 40px; font-size: 13px; line-height: 1.45; color: #222; }
.intro p { margin: 0; }
.intro .lang { margin-bottom: 6px; }
.strip-wrap { position: relative; }
.strip-wrap + .strip-wrap { margin-top: 40px; }
.gallery-lead.strip { display: flex; flex-direction: row; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.gallery-lead.strip::-webkit-scrollbar { display: none; }
.gallery-lead.strip img { flex: 0 0 auto; width: auto !important; max-width: none !important; height: var(--strip-h, min(25vw, 340px)) !important; scroll-snap-align: start; cursor: zoom-in; }
.strip-nav { display: flex; align-items: center; gap: 20px; margin-top: 14px; }
.strip-bar { flex: 1; height: 1px; background: #d4d4d0; } .strip-bar i { display: block; height: 1px; width: 0; background: #111; transition: width .15s; }
.strip-n { font-size: 11px; letter-spacing: .08em; font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }
.strip-btn { background: none; border: 0; padding: 0 2px; font: inherit; font-size: 15px; line-height: 1; color: #111; cursor: pointer; transition: opacity .2s; }
.strip-btn:hover { opacity: .45; } .strip-btn:disabled { opacity: .15; cursor: default; }
@media (max-width: 700px) { .gallery-lead.strip img { height: 42vw !important; } }

.vpair { display: flex; gap: 16px; align-items: flex-start; }
.vpair > div { flex: var(--r) 1 0; min-width: 0; }
.vpair .embed { max-width: none !important; }
.vp-i { overflow: hidden; display: block !important; }
.vp-i img { display: block; max-width: none !important; height: auto !important; }

/* Videos side by side (jw_video_side) */
.embed-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.embed-row .embed { max-width: none !important; }
@media (max-width: 760px) { .embed-row { grid-template-columns: 1fr; } }

.model3d { position: relative; aspect-ratio: 1; margin-top: 40px; cursor: grab; touch-action: pan-y; }
.model3d:active { cursor: grabbing; }
.model3d canvas { display: block; width: 100% !important; height: 100% !important; opacity: 0; transition: opacity .8s; }
.model3d.ready canvas { opacity: 1; }
.model-hint { position: absolute; left: 0; bottom: 0; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .45; transition: opacity .4s; pointer-events: none; }
.model3d.touched .model-hint { opacity: 0; }
