/* =========================================================================
   Homepage showcase
   1. Featured work: three pages that stack as you scroll, with soft folder
      tabs that line up into a row (logic after wildyriftian.com).
   2. Project folder: a glass folder whose files rise, fan out and spread into a
      tray as you scroll (after convodesign101.xyz). Clicking a file opens an
      Android-style dialog.
   Behaviour lives in site-showcase.js.
   ========================================================================= */

/* Images with a dark and a light version: show the one that matches the site theme */
.only-light { display: none !important; }
:root[data-theme="light"] .only-light { display: block !important; }
:root[data-theme="light"] .only-dark { display: none !important; }

/* ------------------------------ 1. Featured work ------------------------------
   Three pages that stack as you scroll (the logic of wildyriftian.com's featured works): each page
   sticks just under the header and the next one slides up over it. Each page's soft tab sits one
   slot further right, so the stacked tabs line up into a row, with "See all works" in the last slot. */
.fw-block { padding-bottom: 0; }
.fw {
  --fw-top: 84px;                                   /* header (74px) + a little air */
  --fw-gap: 8px; --fw-pad: clamp(14px, 2vw, 28px);
  --fw-in: calc(var(--fw-pad) + 26px);              /* tabs sit in from the page's rounded corners */
  --fw-slot: calc((100% - 2 * var(--fw-in) - 3 * var(--fw-gap)) / 4);
  --fw-mono: var(--sans);              /* labels use the site sans (Jost), uppercase and spaced */
  position: relative; margin: 28px 0 0;               /* full screen width */
}
.fw-page {
  --fw-paper: #fffdf8; --fw-ink: #2b2418; --fw-dim: #6b6152; --fw-line: rgba(43, 36, 24, 0.24); --fw-chip: rgba(43, 36, 24, 0.06);
  position: sticky; top: var(--fw-top); height: calc(100vh - var(--fw-top)); height: calc(100svh - var(--fw-top));
  display: flex; flex-direction: column;
}
/* a short pause before the next page's tab rises into view */
.fw-page + .fw-page { margin-top: 14vh; }
.fw-p2 { --fw-paper: #f1dca4; --fw-ink: #2b2112; --fw-dim: #6a5532; --fw-line: rgba(60, 40, 10, 0.28); --fw-chip: rgba(60, 40, 10, 0.08); }
.fw-p3 { --fw-paper: #1d242b; --fw-ink: #f4efe4; --fw-dim: #a8a196; --fw-line: rgba(244, 239, 228, 0.22); --fw-chip: rgba(244, 239, 228, 0.07); }
:root[data-theme="light"] .fw-p3 { --fw-paper: #2a2620; }

/* the tab row: transparent except the tab(s) */
.fw-bar { position: relative; flex: none; height: 50px; pointer-events: none; } /* empty parts of a later page's tab row let clicks through to See all works */
.fw-page { pointer-events: none; }
.fw-bar .fw-tab, .fw-panel { pointer-events: auto; }
.fw-tab {
  position: absolute; bottom: 0; left: calc(var(--fw-in) + var(--n) * (var(--fw-slot) + var(--fw-gap))); width: var(--fw-slot);
  height: 50px; box-sizing: border-box; display: flex; align-items: center; gap: 10px; padding: 0 20px;
  border-radius: 16px 16px 0 0; background: var(--fw-paper); color: var(--fw-ink);
  font: 600 0.78rem/1 var(--fw-mono); letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; text-decoration: none;
}
.fw-num { opacity: 0.7; overflow: hidden; text-overflow: ellipsis; }
.fw-dot { width: 6px; height: 6px; margin-left: auto; flex: none; border-radius: 50%; background: var(--cinnabar, #c8503a); }
/* soft "shoulders" where each tab flows into its page */
.fw-tab::before, .fw-tab::after { content: ""; position: absolute; bottom: 0; width: 16px; height: 16px; pointer-events: none; }
.fw-tab::before { right: 100%; background: radial-gradient(circle at 0 0, transparent 15.5px, var(--fw-paper) 16px); }
.fw-tab::after { left: 100%; background: radial-gradient(circle at 100% 0, transparent 15.5px, var(--fw-paper) 16px); }
.fw-all {
  left: auto; right: var(--fw-in); background: var(--ink-2, #12171c); color: var(--gold, #d4af62);
  border: 1px solid var(--border-gold, rgba(212, 175, 98, 0.35)); border-bottom: 0; transition: color .2s ease;
}
.fw-all::before, .fw-all::after { display: none; }
.fw-all .fw-arrow { margin-left: auto; transition: transform .2s ease; }
.fw-all:hover { color: var(--gold-bright, #f2d999); }
.fw-all:hover .fw-arrow { transform: translateX(4px); }
.fw-all:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
:root[data-theme="light"] .fw-all { background: #2b2418; }
.fw-all-short { display: none; }
/* keep the tab clear of the lantern hanging in the top-right corner */
@media (max-width: 1760px) and (min-width: 721px) { .fw-all { right: calc(var(--fw-in) + 60px); width: calc(var(--fw-slot) - 60px); } }
@media (max-width: 1180px) and (min-width: 721px) { .fw-all-text { display: none; } .fw-all-short { display: inline; } .fw-all { padding: 0 14px; } }

.fw-panel {
  flex: 1; min-height: 0; display: flex; flex-direction: column; box-sizing: border-box;
  padding: clamp(18px, 3.2vh, 34px) var(--fw-pad) clamp(32px, 7vh, 72px); border-radius: 0;
  background: var(--fw-paper); color: var(--fw-ink);
}
.fw-head { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 32px; align-items: start; }
.fw-title { font-family: var(--serif); font-weight: 500; font-size: clamp(1.7rem, min(3.8vw, 6.2vh), 3.6rem); line-height: 1.08; letter-spacing: -0.01em; color: var(--fw-ink); }
.fw-meta { display: grid; gap: 8px; font: 0.8rem/1.4 var(--fw-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--fw-ink); }
.fw-meta .fw-type { color: var(--fw-dim); }
.fw-tags { position: relative; overflow: hidden; margin-top: 10px; padding: 6px 0; background: var(--fw-chip);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.fw-tags-track { display: flex; width: max-content; white-space: nowrap; animation: fw-marquee 18s linear infinite; }
.fw-tags-track span { padding-right: 28px; } /* the same space after every tag, so both halves match and the loop is seamless */
@keyframes fw-marquee { to { transform: translateX(-50%); } }
.fw-rule { flex: none; margin: clamp(14px, 3vh, 26px) calc(-1 * var(--fw-pad)); border: 0; border-top: 1px dotted var(--fw-line); }
.fw-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr); gap: clamp(16px, 2vw, 32px); }
.fw-desc { min-height: 0; overflow: hidden; }
.fw-desc p { font: 0.84rem/1.75 var(--fw-mono); color: var(--fw-ink); text-transform: uppercase; letter-spacing: 0.04em; }
.fw-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; min-height: 44px; font: 600 0.82rem/1 var(--fw-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--fw-ink); text-decoration: none; }
.fw-link span { transition: transform .2s ease; }
.fw-link:hover span { transform: translateX(4px); }
.fw-links { display: flex; flex-wrap: wrap; column-gap: 28px; margin-top: 12px; }
.fw-links .fw-link { margin-top: 0; } /* two links side by side, wrapping on narrow screens */
.fw-media { position: relative; min-height: 0; overflow: hidden; border-radius: 14px; background: #e9e1cf; }
.fw-p3 .fw-media { background: #2c343c; }
.fw-media img, .fw-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fw-side { min-height: 0; display: flex; flex-direction: column; gap: clamp(12px, 2vh, 20px); }
.fw-side .fw-media { flex: 1; }
/* a screenshot shown whole: the box takes the picture's shape (and shrinks to fit if the space is short) */
.fw-media.is-fit { align-self: center; height: auto; max-height: 100%; aspect-ratio: 1996 / 1036; background: none; }
.fw-media.is-fit img { object-fit: contain; }
/* Phone-shaped slots for app projects: three portrait screens (the middle one a little bigger).
   An empty slot shows a dashed phone outline; once it holds an <img>, the box disappears so a
   transparent-background mockup sits straight on the page. */
.fw-phones {
  grid-column: 2 / -1; min-height: 0; container-type: size;
  display: flex; justify-content: center; align-items: center; gap: clamp(14px, 3vw, 44px);
}
.fw-phone {
  --fw-ph-h: min(100cqh, calc((100cqw - (var(--count, 3) - 1) * clamp(14px, 3vw, 44px)) / var(--count, 3) * 19.5 / 9));
  --h: calc(var(--fw-ph-h) * 0.86);
  position: relative; flex: none; height: var(--h); aspect-ratio: 9 / 19.5;
  display: grid; place-items: center; box-sizing: border-box; border-radius: 13% / 6%;
  border: 1.5px dashed var(--fw-line); background: var(--fw-chip);
}
.fw-phone.is-hero { --h: var(--fw-ph-h); }
.fw-phone::before { /* the speaker notch */
  content: ""; position: absolute; top: 3.2%; left: 50%; width: 30%; height: 2.2%; border-radius: 99px; transform: translateX(-50%);
  background: var(--fw-line);
}
.fw-phone-ph { padding: 12px; text-align: center; font-size: 0.8rem; font-style: italic; color: var(--fw-dim); }
.fw-phone-ph b { display: block; font-size: 2.2rem; font-style: normal; margin-bottom: 6px; }
.fw-phone:has(img) { border: 0; background: none; }
.fw-phone:has(img)::before { display: none; }
.fw-phone.is-framed { /* a dark phone body around the screenshot */
  border: 0; padding: calc(var(--h) * 0.0133); background: linear-gradient(160deg, #2a2a2c, #0e0e10);
  aspect-ratio: 476 / 1000; /* so the screen inside the bezel matches the 923×2000 screenshots exactly (no cropping) */
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.10), 0 22px 40px rgba(60, 40, 10, 0.30);
}
.fw-phone.is-framed::before { /* front camera */
  display: block !important; z-index: 2; top: 2.4%; width: 3.6%; height: auto; aspect-ratio: 1; border-radius: 50%; background: #0b0b0c;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.06);
}
.fw-phone.is-framed img { position: relative; inset: auto; display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; border-radius: 11% / 5.2%; filter: none; }
.fw-phone img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 18px 30px rgba(60, 40, 10, 0.28)); }
.fw-ph { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 16px; font-size: 0.85rem; font-style: italic; color: #6b6152; }
.fw-ph b { display: block; font-size: 2.6rem; font-style: normal; margin-bottom: 8px; }

@media (max-width: 1000px) {
  .fw-head { grid-template-columns: 1fr; gap: 10px; }
  .fw-meta { grid-template-columns: auto auto; justify-content: start; column-gap: 18px; }
  .fw-tags { grid-column: 1 / -1; margin-top: 2px; }
  .fw-body { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
  .fw-side { display: none; }
  .fw-phones { grid-column: 2; }
}
@media (max-width: 720px) {
  .fw { --fw-top: 80px; --fw-gap: 5px; }
  .fw-tab { padding: 0 12px; gap: 6px; font-size: 0.72rem; }
  .fw-tab .fw-num { display: none; }
  .fw-all-text { display: none; }
  .fw-all .fw-arrow { margin: 0 auto; font-size: 1rem; }
  .fw-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 14px; }
  .fw-desc p { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; font-size: 0.78rem; }
  .fw-link { margin-top: 2px; }
  .fw-main { order: 2; }
  .fw-phones { grid-column: 1; --count: 2 !important; }
  .fw-phone:not(.is-hero) { display: none; }
}
@media (max-height: 640px) and (min-width: 721px) { .fw-desc p { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; } }
@media (prefers-reduced-motion: reduce) { .fw-tags-track { animation: none; } }

/* ------------------------------ 2. Project folders ------------------------------
   Measured from convodesign101's Resources & Events folders: a 463×360 folder, 360×275 back,
   360×198 two-layer glass front, 157×192 files. --u is one of those pixels at the current size. */
.pf {
  --pf-word-rgb: 184, 142, 62;  /* darker gold */ --pf-paper: #fbf8f1; /* title colour; its strength comes from --pf-a */ --pf-ink: #2b2418; --pf-dim: #7a7062;
  /* the folder colour (convodesign uses cyan; this is the site's gold) */
  --pf-back: linear-gradient(180deg, #e6c67e 0%, #e3c178 62%, #cfa75a 100%);
  --pf-glass-a: rgba(255, 190, 240, 0.5); --pf-glass-b: rgba(232, 194, 108, 0.5); --pf-glass-c: rgba(214, 170, 78, 0.5);
  --pf-glow: rgba(255, 246, 222, 0.8); --pf-deep: rgba(110, 78, 18, 0.2);
  position: relative; z-index: 1; padding: 10vh 16px 22vh;
  scroll-margin-top: 74px; /* the navbar's Works link lands here, below the sticky header */
}
:root[data-theme="light"] .pf {
  --pf-word-rgb: 43, 36, 24;
  --pf-back: linear-gradient(180deg, #edd393 0%, #e9cd8a 62%, #d8b468 100%);
  --pf-glass-a: rgba(255, 200, 240, 0.5); --pf-glass-b: rgba(238, 206, 132, 0.5); --pf-glass-c: rgba(222, 182, 96, 0.5);
}
/* the big faded title stays pinned while the folders scroll over it */
.pf-word {
  position: sticky; top: 160px; z-index: 0; margin: 0;
  font-family: var(--serif); font-weight: 700; font-size: clamp(3.2rem, 11vw, 9.5rem); line-height: 0.92; letter-spacing: -0.03em;
  text-align: center; color: rgba(var(--pf-word-rgb), var(--pf-a, 0.13)); user-select: none;
}
.pf-grid {
  position: relative; z-index: 1; display: grid; grid-template-columns: repeat(2, auto); justify-content: center;
  gap: 10px 120px; margin: 4vh auto 0;
}
.pf-folder.is-top, .pf-folder.is-bottom { grid-column: 1 / -1; justify-self: center; }
.pf-hint { position: relative; z-index: 1; text-align: center; color: var(--text-dim); font-size: 0.9rem; margin: 3vh auto 0; max-width: 34ch; } /* sits under the title, before the folders */

.pf-folder { width: min(473px, calc(100vw - 24px)); aspect-ratio: 463 / 360; container-type: inline-size; cursor: pointer; }
.pf-move {
  --u: calc(100cqw / 463); position: relative; width: 100%; height: 100%;
  transform: rotate(calc(var(--tilt, 0) * 1deg)); will-change: transform;
}
.pf-move::before { /* soft shadow under the folder */
  content: ""; position: absolute; left: calc(var(--u) * 75); top: calc(var(--u) * 137); width: calc(var(--u) * 313); height: calc(var(--u) * 173);
  border-radius: calc(var(--u) * 80); background: rgba(0, 0, 0, 0.3); filter: blur(5px);
}
/* the folder back: one silhouette with the tab built in, plus a light rim along the edge and just inside it */
.pf-back {
  position: absolute; left: calc(var(--u) * 55); top: calc(var(--u) * 42); width: calc(var(--u) * 360); height: calc(var(--u) * 259);
  background: var(--pf-back); transform-origin: 50% 100%; /* hinged at the bottom, like the front */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 360 259' preserveAspectRatio='none'%3E%3Cpath d='M0 18Q0 0 18 0H109Q119 0 124 9L129 18Q131 21 136 21H341Q360 21 360 40V240Q360 259 341 259H19Q0 259 0 240Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 360 259' preserveAspectRatio='none'%3E%3Cpath d='M0 18Q0 0 18 0H109Q119 0 124 9L129 18Q131 21 136 21H341Q360 21 360 40V240Q360 259 341 259H19Q0 259 0 240Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  transition: transform .45s cubic-bezier(.3, 1.35, .6, 1);
}
.pf-back::after {
  content: ""; position: absolute; inset: 0; background: rgba(255, 250, 236, 0.55);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 360 259' preserveAspectRatio='none' fill='none' stroke='%23000'%3E%3Cpath stroke-width='2.4' d='M0 18Q0 0 18 0H109Q119 0 124 9L129 18Q131 21 136 21H341Q360 21 360 40V240Q360 259 341 259H19Q0 259 0 240Z'/%3E%3Cpath stroke-width='1' transform='translate(5 5) scale(0.9722 0.9614)' d='M0 18Q0 0 18 0H109Q119 0 124 9L129 18Q131 21 136 21H341Q360 21 360 40V240Q360 259 341 259H19Q0 259 0 240Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 360 259' preserveAspectRatio='none' fill='none' stroke='%23000'%3E%3Cpath stroke-width='2.4' d='M0 18Q0 0 18 0H109Q119 0 124 9L129 18Q131 21 136 21H341Q360 21 360 40V240Q360 259 341 259H19Q0 259 0 240Z'/%3E%3Cpath stroke-width='1' transform='translate(5 5) scale(0.9722 0.9614)' d='M0 18Q0 0 18 0H109Q119 0 124 9L129 18Q131 21 136 21H341Q360 21 360 40V240Q360 259 341 259H19Q0 259 0 240Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.pf-files { position: absolute; inset: 0; }
.pf-file[hidden] { display: none !important; } /* kept for the folder dialog, not shown on the folder */
.pf-file {
  position: absolute; width: calc(var(--u) * 157); height: calc(var(--u) * 192); left: calc(var(--u) * var(--x)); top: calc(var(--u) * var(--y));
  padding: calc(var(--u) * 10); box-sizing: border-box; border-radius: calc(var(--u) * 8);
  display: flex; flex-direction: column; gap: calc(var(--u) * 4); background: var(--pf-paper); color: var(--pf-ink); text-decoration: none;
  box-shadow: 0 calc(var(--u) * 4) calc(var(--u) * 14) rgba(0, 0, 0, 0.22);
  transform: rotate(calc(var(--r) * 1deg));
  transition: transform .45s cubic-bezier(.3, 1.35, .6, 1), box-shadow .25s ease;
}
.pf-thumb { display: block; flex: none; height: calc(var(--u) * 92); border-radius: calc(var(--u) * 5); overflow: hidden; background: #e9e1cf; }
.pf-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-thumb.is-ph { display: grid; place-items: center; font-size: calc(var(--u) * 40); }
.pf-file strong { font-family: var(--serif); font-size: max(0.78rem, calc(var(--u) * 17)); line-height: 1.12; margin-top: calc(var(--u) * 4); }
.pf-file .pf-sub { font-size: max(0.7rem, calc(var(--u) * 12)); line-height: 1.25; color: var(--pf-dim); }
.pf-file:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
/* resting in the folder (only the tops peek out above the glass) */
.pf-files.n3 .pf-file:nth-child(1) { --x: 63; --y: 81; --r: 0; }
.pf-files.n3 .pf-file:nth-child(2) { --x: 139; --y: 94; --r: 0; z-index: 1; } /* the middle file sits in front */
.pf-files.n3 .pf-file:nth-child(3) { --x: 230; --y: 86; --r: 2; } /* left to right: newest, next, older */
.pf-files.n4 .pf-file:nth-child(1) { --x: 52; --y: 88; --r: -3; }
.pf-files.n4 .pf-file:nth-child(2) { --x: 118; --y: 82; --r: -1; }
.pf-files.n4 .pf-file:nth-child(3) { --x: 190; --y: 84; --r: 1; }
.pf-files.n4 .pf-file:nth-child(4) { --x: 258; --y: 90; --r: 3; }
.pf-files.n1 .pf-file { --x: 153; --y: 86; --r: -1; }
.pf-files.n2 .pf-file:nth-child(1) { --x: 88; --y: 84; --r: -2; }
.pf-files.n2 .pf-file:nth-child(2) { --x: 214; --y: 90; --r: 2; }
/* hovered: they pop up and splay out */
.pf-folder.is-open .pf-files.n3 .pf-file:nth-child(1) { transform: translate(calc(var(--u) * -47), calc(var(--u) * -81)) rotate(-9deg); }
.pf-folder.is-open .pf-files.n3 .pf-file:nth-child(2) { transform: translate(calc(var(--u) * 18), calc(var(--u) * -76)); }
.pf-folder.is-open .pf-files.n3 .pf-file:nth-child(3) { transform: translate(calc(var(--u) * 64), calc(var(--u) * -75)) rotate(4deg); }
.pf-folder.is-open .pf-files.n4 .pf-file:nth-child(1) { transform: translate(calc(var(--u) * -62), calc(var(--u) * -70)) rotate(-13deg); }
.pf-folder.is-open .pf-files.n4 .pf-file:nth-child(2) { transform: translate(calc(var(--u) * -22), calc(var(--u) * -82)) rotate(-4deg); }
.pf-folder.is-open .pf-files.n4 .pf-file:nth-child(3) { transform: translate(calc(var(--u) * 22), calc(var(--u) * -82)) rotate(4deg); }
.pf-folder.is-open .pf-files.n4 .pf-file:nth-child(4) { transform: translate(calc(var(--u) * 62), calc(var(--u) * -70)) rotate(13deg); }
.pf-folder.is-open .pf-files.n1 .pf-file { transform: translate(0, calc(var(--u) * -80)) rotate(2deg); }
.pf-folder.is-open .pf-files.n2 .pf-file:nth-child(1) { transform: translate(calc(var(--u) * -44), calc(var(--u) * -80)) rotate(-8deg); }
.pf-folder.is-open .pf-files.n2 .pf-file:nth-child(2) { transform: translate(calc(var(--u) * 52), calc(var(--u) * -76)) rotate(5deg); }
.pf-folder.is-open .pf-file:hover { box-shadow: 0 calc(var(--u) * 10) calc(var(--u) * 28) rgba(0, 0, 0, 0.35); }
.pf-folder.is-open .pf-back { transform: skewX(8deg); }
/* the glass front: an outer pane and a tinted inner pane */
.pf-front {
  position: absolute; left: calc(var(--u) * 55); top: calc(var(--u) * 104); width: calc(var(--u) * 360); height: calc(var(--u) * 198);
  box-sizing: border-box; padding: calc(var(--u) * 4); border-radius: calc(var(--u) * 18); transform-origin: 50% 100%; z-index: 2; /* clicking the glass opens the folder */
  -webkit-backdrop-filter: blur(1px); backdrop-filter: blur(1px); /* light blur: the files behind stay readable */
  box-shadow: inset 0 0 calc(var(--u) * 16) var(--pf-glow), 0 calc(var(--u) * -4) calc(var(--u) * 4) var(--pf-deep);
  transition: transform .45s cubic-bezier(.3, 1.35, .6, 1), box-shadow .45s ease;
}
.pf-glass {
  position: relative; display: block; width: 100%; height: 100%; border-radius: calc(var(--u) * 16);
  background: linear-gradient(180deg, var(--pf-glass-a) 0%, var(--pf-glass-b) 32%, var(--pf-glass-c) 89%);
  -webkit-backdrop-filter: blur(1.5px); backdrop-filter: blur(1.5px);
  box-shadow: inset 0 calc(var(--u) * -2) calc(var(--u) * 8) var(--pf-glass-c), inset calc(var(--u) * -2) calc(var(--u) * 4) calc(var(--u) * 16) calc(var(--u) * 4) var(--pf-glow), 0 0 calc(var(--u) * 16) var(--pf-deep);
}
.pf-folder.is-open .pf-front { transform: skewX(-12deg); box-shadow: inset 0 0 calc(var(--u) * 16) var(--pf-glow), calc(var(--u) * -8) calc(var(--u) * -4) calc(var(--u) * 12) var(--pf-deep); }
.pf-label {
  position: absolute; left: calc(var(--u) * 20); bottom: calc(var(--u) * 21); padding: calc(var(--u) * 4) calc(var(--u) * 8); border-radius: calc(var(--u) * 8);
  font-size: max(0.78rem, calc(var(--u) * 15)); font-weight: 600; color: #fff; white-space: nowrap; text-shadow: 0 1px 4px rgba(90, 60, 10, 0.4);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 43%, rgba(214, 170, 78, 0.1) 100%); box-shadow: -1px 1px 2px rgba(110, 78, 18, 0.2);
}
:root[data-theme="light"] .pf-label { color: #fff; }
@media (max-width: 1100px) {
  .pf-grid { grid-template-columns: auto; gap: 10px; }
  .pf-folder.is-top, .pf-folder.is-bottom { grid-column: auto; }
}
@media (max-width: 760px) { .pf-word { top: 18vh; } }
@media (max-width: 560px) { /* narrower fans so the files stay on screen */
  .pf-folder.is-open .pf-files.n4 .pf-file:nth-child(1) { transform: translate(calc(var(--u) * -28), calc(var(--u) * -70)) rotate(-9deg); }
  .pf-folder.is-open .pf-files.n4 .pf-file:nth-child(2) { transform: translate(calc(var(--u) * -8), calc(var(--u) * -80)) rotate(-3deg); }
  .pf-folder.is-open .pf-files.n4 .pf-file:nth-child(3) { transform: translate(calc(var(--u) * 8), calc(var(--u) * -80)) rotate(3deg); }
  .pf-folder.is-open .pf-files.n4 .pf-file:nth-child(4) { transform: translate(calc(var(--u) * 28), calc(var(--u) * -70)) rotate(9deg); }
  .pf-folder.is-open .pf-files.n3 .pf-file:nth-child(1) { transform: translate(calc(var(--u) * -28), calc(var(--u) * -78)) rotate(-7deg); }
}
@media (prefers-reduced-motion: reduce) {
  .pf-file, .pf-front, .pf-back { transition: none; }
}

/* ------------------------------ Inside a folder ------------------------------
   Opening a folder goes inside it (motion in site-showcase.js): the folder's front falls open,
   the inside opens out from where the folder sits, and the projects rise out as paper pages. */
.pt {
  width: min(1180px, calc(100vw - 32px)); max-width: none; height: min(calc(100dvh - 48px), 880px); max-height: none;
  padding: 0; margin: auto; border: 0; background: transparent; overflow: visible; color: #2b2418;
}
.pt::backdrop { background: rgba(6, 8, 10, 0.62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.pt.is-closing::backdrop { opacity: 0; transition: opacity .35s ease; }
.pt-folder { /* the inside of the folder: its back panel, with the tab sticking up on the left */
  position: absolute; inset: 40px 0 0; border-radius: 0 26px 26px 26px; outline: none;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(110, 78, 18, 0.28), transparent 60%),          /* the shadow just inside the opening */
    linear-gradient(180deg, #e6c67e 0%, #e3c178 62%, #cfa75a 100%);
  box-shadow: inset 0 0 0 1.5px rgba(255, 250, 236, 0.55), inset 0 0 40px rgba(110, 78, 18, 0.18), 0 40px 90px rgba(0, 0, 0, 0.45);
}
:root[data-theme="light"] .pt-folder { box-shadow: inset 0 0 0 1.5px rgba(255, 250, 236, 0.6), inset 0 0 40px rgba(110, 78, 18, 0.14), 0 40px 90px rgba(80, 60, 20, 0.3); }
.pt-tab {
  position: absolute; left: 0; bottom: 100%; height: 42px; display: flex; align-items: center; gap: 12px; padding: 0 26px 0 22px;
  border-radius: 18px 18px 0 0; background: #e6c67e; box-shadow: inset 0 1.5px 0 rgba(255, 250, 236, 0.55);
}
.pt-tab::after { /* the soft shoulder where the tab meets the folder */
  content: ""; position: absolute; left: 100%; bottom: 0; width: 18px; height: 18px;
  background: radial-gradient(circle at 100% 0, transparent 17.5px, #e6c67e 18px);
}
.pt-label { font: 600 1.05rem/1 var(--sans); color: #fff; text-shadow: 0 1px 4px rgba(90, 60, 10, 0.45); white-space: nowrap; }
.pt-count { font: 600 0.72rem/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: rgba(78, 56, 14, 0.7); white-space: nowrap; }
.pt-x {
  position: absolute; top: 14px; right: 16px; z-index: 3; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: rgba(255, 255, 255, 0.4); color: #4e3c12; font-size: 1rem;
}
.pt-x:hover { background: rgba(255, 255, 255, 0.7); }
.pt-x:focus:not(:focus-visible), .pt-folder:focus { outline: none; }
.pt-pages {
  position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; border-radius: inherit;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); align-content: start; gap: 34px 28px;
  padding: 44px clamp(20px, 4vw, 52px) 56px;
  scrollbar-width: thin; scrollbar-color: rgba(120, 84, 20, 0.45) transparent;
}
/* a project page: paper with a strip of tape, sitting slightly crooked until you point at it */
.pt-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; box-sizing: border-box; padding: 12px 12px 18px;
  border-radius: 6px; background: #fbf8f1; color: #2b2418; text-decoration: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 12px 26px rgba(80, 54, 6, 0.22), 0 2px 4px rgba(80, 54, 6, 0.12);
  transform: rotate(calc(var(--rot, 0) * 1deg));
  transition: transform .3s cubic-bezier(.3, 1.35, .6, 1), box-shadow .25s ease;
}
.pt-card::before { /* tape */
  content: ""; position: absolute; top: -9px; left: 50%; width: 64px; height: 18px; translate: -50% 0; rotate: calc(var(--rot, 0) * -2deg);
  background: rgba(255, 252, 240, 0.62); box-shadow: 0 1px 2px rgba(80, 54, 6, 0.15);
}
.pt-card:hover, .pt-card:focus-visible { transform: translateY(-6px) rotate(0deg); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 22px 40px rgba(80, 54, 6, 0.3); outline: none; }
.pt-card:focus-visible { outline: 3px solid #8f6a24; outline-offset: 3px; }
.pt-thumb { position: relative; display: block; aspect-ratio: 16 / 10; border-radius: 3px; overflow: hidden; background: #e9e1cf; margin-bottom: 6px; }
.pt-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; display: block; }
.pt-thumb.is-tall { background: #e9e1d2; } /* the phone mockups' own cream background */
.pt-thumb.is-fit img { object-fit: contain; object-position: 50% 50% !important; } /* a screenshot shown whole */
.pt-thumb.is-tall img { object-fit: contain; object-position: 50% 50% !important; padding: 4px 0; box-sizing: border-box; }
.pt-thumb.is-play { display: grid; place-items: center; background: linear-gradient(150deg, #2b2418, #4a3a1c); color: #f2d999; font: 600 0.8rem/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; }
.pt-card strong { font-family: var(--serif); font-size: 1.18rem; line-height: 1.2; }
.pt-card .pt-sub { font-size: 0.8rem; line-height: 1.35; color: #7a6a4c; }
.pt-card p { font-size: 0.86rem; line-height: 1.5; color: #4c4438; margin: 4px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pt-group { /* a category heading inside a folder (Client work) */
  grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; margin: 6px 0 -10px;
  font: 600 0.78rem/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: rgba(78, 56, 14, 0.78);
}
.pt-group::after { content: ""; flex: 1; height: 1px; background: rgba(110, 78, 18, 0.28); }
.pt-group:not(:first-child) { margin-top: 18px; }
.pt-card .pt-go { margin-top: auto; padding-top: 10px; font: 600 0.74rem/1 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: #9c7620; }
@media (max-width: 720px) {
  .pt { width: calc(100vw - 16px); height: calc(100dvh - 24px); }
  .pt-folder { inset: 36px 0 0; border-radius: 0 20px 20px 20px; }
  .pt-tab { height: 38px; padding: 0 18px 0 16px; }
  .pt-label { font-size: 0.95rem; }
  .pt-pages { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; padding: 58px 14px 40px; }
  .pt-card { padding: 8px 8px 12px; }
  .pt-card strong { font-size: 0.98rem; }
  .pt-card .pt-sub { font-size: 0.72rem; }
  .pt-card p { display: none; }
  .pt-card .pt-go { font-size: 0.66rem; }
  .pt-x { top: 10px; right: 10px; width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) { .pt-card { transition: none; } }

/* ------------------------------ Project dialog ------------------------------ */
.pd {
  width: min(940px, calc(100vw - 32px)); max-width: none; max-height: min(88vh, 640px); padding: 0; border: 0; border-radius: 28px;
  margin: auto; /* the page's margin reset would otherwise pin it to the top-left corner */
  overflow: hidden; background: #fffdf8; color: #2b2418; box-shadow: 0 40px 90px rgba(0, 0, 0, 0.45);
}
:root:not([data-theme="light"]) .pd { background: #171d23; color: #f4f0e7; }
.pd::backdrop { background: rgba(6, 8, 10, 0.6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.pd.is-closing::backdrop { opacity: 0; transition: opacity .28s ease; }
.pd-inner { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); height: min(88vh, 640px); }
.pd-media { position: relative; overflow: hidden; background: #e9e1cf; }
.pd-media img, .pd-media video, .pd-media iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; }
.pd-media iframe { background: #000; }
.pd-media.is-contain img { object-fit: contain; padding: 20px; box-sizing: border-box; }
.pd-media .fw-ph { color: #6b6152; }
.pd-info { display: flex; flex-direction: column; min-height: 0; padding: 32px 32px 24px; overflow: hidden; }
.pd-date { font: 600 0.74rem/1.3 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); }
.pd-title { font-family: var(--serif); font-size: clamp(1.5rem, 2.6vw, 2.1rem); line-height: 1.12; margin: 10px 0 14px; }
.pd-tech { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.pd-tech span { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; padding: 4px 10px; border-radius: 999px; border: 1px solid currentColor; opacity: 0.75; }
.pd-desc { font-size: 0.95rem; line-height: 1.65; opacity: 0.85; display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; }
.pd-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-top: auto; padding-top: 18px; }
.pd-actions a, .pd-actions button {
  min-height: 40px; padding: 0 18px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px;
  font: 600 0.88rem/1 var(--sans, system-ui); text-decoration: none; cursor: pointer; border: 0;
}
.pd-actions a { background: rgba(212, 175, 98, 0.18); color: inherit; }
.pd-actions a:hover { background: rgba(212, 175, 98, 0.32); }
.pd-actions a.pd-primary { background: var(--gold); color: #1a1408; }
.pd-actions a.pd-primary:hover { background: var(--gold-bright, #f2d999); }
.pd-actions a:not(.pd-primary) { background: transparent; box-shadow: inset 0 0 0 1px rgba(212, 175, 98, 0.45); }
.pd-actions:empty { display: none; }
.pd-x {
  position: absolute; top: 14px; right: 14px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: rgba(12, 15, 18, 0.55); color: #fff; font-size: 1.1rem;
}
.pd-x:hover { background: rgba(12, 15, 18, 0.8); }
/* Previous / Next: sits at the start of the button row, the project buttons and Close stay on the right */
.pd-actions .pd-nav { display: flex; align-items: center; gap: 2px; margin-right: auto; padding: 0 4px; height: 40px; border-radius: 999px; background: rgba(212, 175, 98, 0.12); }
.pd-actions .pd-step { width: 34px; min-height: 34px; height: 34px; padding: 0 0 3px; justify-content: center; border-radius: 50%; background: transparent; color: var(--gold); font-size: 1.5rem; }
.pd-actions .pd-step:hover { background: rgba(212, 175, 98, 0.2); }
.pd-step:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.pd-count { font: 600 0.74rem/1 var(--sans, system-ui); letter-spacing: 0.06em; min-width: 3.6em; text-align: center; opacity: 0.8; font-variant-numeric: tabular-nums; }
.pd .pd-in { animation: fw-rise .5s cubic-bezier(.2, .7, .2, 1) both; }
.pd .pd-in:nth-child(2) { animation-delay: .05s; } .pd .pd-in:nth-child(3) { animation-delay: .1s; }
.pd .pd-in:nth-child(4) { animation-delay: .15s; } .pd .pd-in:nth-child(5) { animation-delay: .2s; }
/* Wide layout (landscape/square content): the picture fills the top, details sit in two columns underneath */
.pd.is-wide { width: min(1040px, calc(100vw - 32px)); max-height: min(92vh, 880px); }
.pd.is-wide .pd-inner { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; height: min(92vh, 880px); }
.pd.is-wide .pd-media.is-contain img { padding: 24px; }
.pd.is-wide .pd-info {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); grid-template-rows: auto auto 1fr; column-gap: 44px;
  padding: 24px 32px 22px;
}
.pd.is-wide .pd-date, .pd.is-wide .pd-title, .pd.is-wide .pd-tech { grid-column: 1; }
.pd.is-wide .pd-title { margin: 8px 0 12px; }
.pd.is-wide .pd-tech { margin-bottom: 0; align-self: start; }
.pd.is-wide .pd-desc { grid-column: 2; grid-row: 1 / 3; -webkit-line-clamp: 4; align-self: start; }
.pd.is-wide .pd-actions { grid-column: 2; grid-row: 3; align-self: end; padding-top: 14px; }
@media (max-width: 720px) {
  .pd { border-radius: 24px; max-height: calc(100dvh - 32px); }
  /* fixed height: the info takes what it needs and the picture shrinks to fit, so it never scrolls */
  .pd-inner { grid-template-columns: 1fr; grid-template-rows: minmax(110px, 1fr) auto; height: min(calc(100dvh - 32px), 760px); max-height: none; }
  .pd-info { padding: 20px 20px 16px; }
  .pd-title { margin: 6px 0 10px; }
  .pd-desc { font-size: 0.9rem; -webkit-line-clamp: 5; }
  .pd-actions { justify-content: flex-start; }
  .pd.is-wide .pd-info { display: flex; padding: 20px 20px 16px; }
  .pd.is-wide .pd-desc { -webkit-line-clamp: 5; }
}
@media (prefers-reduced-motion: reduce) { .pd .pd-in { animation: none; } }
.pf-thumb img.only-dark, .pf-thumb img.only-light { object-position: 50% 45%; } /* show the middle phone */
.pf-file[data-project="portfolio"] .pf-thumb img { object-position: 50% 50%; }

/* Featured work 03 (graphic design): show each square design whole, as large as its slot allows */
.fw-p3 .fw-media { background: none; display: flex; align-items: center; justify-content: center; }
.fw-p3 .fw-media img { position: static; width: auto; height: auto; max-width: 100%; max-height: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 14px; }
/* keep the squares together: the main design hugs the side column, the side designs hug the main one */
.fw-p3 .fw-main { justify-content: flex-end; }
.fw-p3 .fw-side .fw-media { justify-content: flex-start; }
.fw-p3 .fw-side { justify-content: center; }
.fw-p3 .fw-side .fw-media { flex: 0 1 auto; min-height: 0; }

/* the gallery wrapper only matters on phones; elsewhere its children sit in the grid as before */
.fw-gallery { display: contents; }

/* Phones: every pop-up has the same layout. The picture keeps its real shape (9:16 video, square
   design, wide website), shown whole and scaled to fit, centred above the details. */
@media (max-width: 720px) {
  .pd .pd-inner, .pd.is-wide .pd-inner { display: flex; flex-direction: column; height: auto; max-height: calc(100dvh - 32px); }
  .pd .pd-media, .pd.is-wide .pd-media {
    position: relative; flex: none; display: block; box-sizing: border-box;
    --mh: 46dvh; aspect-ratio: var(--ar, 1); width: min(calc(100% - 40px), calc(var(--mh) * var(--ar, 1))); height: auto;
    margin: 56px auto 0; border-radius: 14px; overflow: hidden; background: #0d1014;
  }
  .pd .pd-media img, .pd .pd-media video, .pd .pd-media iframe, .pd .pd-media.is-contain img, .pd.is-wide .pd-media.is-contain img { object-fit: contain; padding: 0; }
  .pd .pd-info, .pd.is-wide .pd-info { display: flex; flex-direction: column; padding: 18px 20px 14px; min-height: 0; }
  .pd .pd-tech { margin-bottom: 12px; }
  .pd .pd-desc { -webkit-line-clamp: 5; }
  .pd .pd-actions { justify-content: flex-start; padding-top: 14px; }
  .pd .pd-x { top: 10px; right: 10px; width: 36px; height: 36px; }
  .pd .pd-actions .pd-nav { height: 36px; }
  .pd .pd-actions .pd-step { width: 30px; height: 30px; min-height: 30px; padding: 0 0 3px; }
}
@media (max-width: 720px) and (max-height: 700px) {
  .pd .pd-media, .pd.is-wide .pd-media { --mh: 28dvh; margin-top: 50px; width: min(calc(100% - 40px), calc(28dvh * var(--ar, 1))); }
  .pd .pd-desc { -webkit-line-clamp: 3; }
  .pd .pd-info, .pd.is-wide .pd-info { padding: 14px 18px 10px; }
  .pd .pd-tech { margin-bottom: 8px; }
  .pd .pd-actions { padding-top: 8px; gap: 6px; }
  .pd .pd-actions a, .pd .pd-actions button { min-height: 34px; padding: 0 14px; font-size: 0.82rem; }
  .pd[data-project="emm-store"] .pd-desc { -webkit-line-clamp: 2; } /* the storefront card has the most text and two links */
}

