/* ==========================================================================
   tangun.ca · Portfolio page
   ---------------------------------------------------------------------------
   One grid of every project with a filter bar, and a lightbox that walks
   through each project's images and videos. The markup is generated by
   tangun-ca/tools/build_portfolio.py. Standalone: tokens copied from the home
   page's stylesheet, none of its scroll-snap or pinned tracks.
   ========================================================================== */

:root {
  --font-display: "Fredericka the Great", cursive;
  --font-serif: "Unna", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  --color-bg: #f4f4f4;
  --color-bg-raised: #e8e7e4;
  --color-text-primary: #222;
  --color-text-secondary: #3d3d3d;
  --color-text-tertiary: #6f6f6f;
  --color-border: rgba(34, 34, 34, 0.15);
  --color-accent: #4eb2ba;
  --color-dark: #222;

  --gutter: clamp(20px, 6vw, 110px);
  --ease-quart-out: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-expo-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  overflow-x: clip;
  background: var(--color-bg);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
img, video { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
::selection { background: var(--color-accent); color: #fff; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }

/* ---- Fixed chrome, same positions as home -------------------------------- */
.fixed-logo { position: fixed; top: 20px; left: 25px; z-index: 50; width: 30px; }
.fixed-logo img { width: 30px; height: auto; }
.fixed-email {
  position: fixed; bottom: 0; left: 20px; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  width: 50px; height: 80px;
}
.fixed-email img { width: 40px; height: auto; }

/* ---- Header ---------------------------------------------------------------- */
.pf-header {
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(110px, 16vh, 180px) var(--gutter) clamp(36px, 6vh, 64px);
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; letter-spacing: 0.02em; color: var(--color-text-secondary);
}
.eyebrow .spark { color: var(--color-accent); font-size: 18px; line-height: 1; }
.pf-display {
  margin-top: 14px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.6rem, 3vw + 1.6rem, 5.5rem);
  line-height: 1.05;
  color: #333;
}
.lede {
  margin-top: 18px;
  max-width: 52ch;
  font-size: 15px; font-weight: 300; line-height: 1.7;
  color: var(--color-text-secondary);
}

/* ---- Filter bar ------------------------------------------------------------
   Sticks to the top edge while the grid scrolls. Scrolls sideways on narrow
   screens rather than wrapping into a tall block. */
.pf-filters {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(244, 244, 244, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}
.pf-filters__inner {
  display: flex;
  gap: clamp(18px, 2.4vw, 36px);
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
}
.pf-filters__inner::-webkit-scrollbar { display: none; }
.pf-filter {
  position: relative;
  flex: 0 0 auto;
  padding: 20px 0 18px;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--color-text-tertiary);
  transition: color 0.3s var(--ease-quart-out);
}
.pf-filter span {
  margin-left: 3px;
  font-size: 10px;
  vertical-align: super;
  color: var(--color-text-tertiary);
}
.pf-filter::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease-expo-out);
}
.pf-filter:hover { color: var(--color-text-primary); }
.pf-filter[aria-pressed="true"] { color: var(--color-text-primary); }
.pf-filter[aria-pressed="true"]::after { transform: scaleX(1); }
.pf-filter:focus-visible { outline-offset: -2px; }

/* ---- Grid -------------------------------------------------------------------- */
.pf-grid-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(36px, 5vw, 64px) var(--gutter) clamp(80px, 12vh, 140px);
}
.pf-status {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
}
.pf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: clamp(36px, 4vw, 56px) clamp(20px, 2.4vw, 36px);
}

.pf-card { display: flex; flex-direction: column; min-width: 0; }
.pf-card.is-entering { animation: cardIn 0.7s var(--ease-expo-out) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

.pf-card__media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 0;
  border-radius: 4px;
  overflow: hidden;
  background: var(--color-bg-raised);
  cursor: zoom-in;
}
/* A project with its own page: the cover is a link, not a lightbox. */
.pf-card__media--case { cursor: pointer; }
.pf-card__media--case .pf-card__count { background: var(--color-accent); color: #fff; opacity: 1; transform: none; }
/* Three possible covers per card; data-view on the card picks one. */
.pf-cover { position: absolute; inset: 0; display: none; }
.pf-card[data-view="photo"] .pf-cover--photo,
.pf-card[data-view="logo"] .pf-cover--logo,
.pf-card[data-view="screen"] .pf-cover--screen { display: block; }

img.pf-cover--photo {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 1s var(--ease-expo-out);
}
.pf-card__media:hover img.pf-cover--photo { transform: scale(1.045); }

/* logo: the no-background mark sitting on the card ground */
.pf-cover--logo { background: #ebeae7; }
.pf-cover--logo img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 12% 18%;
  transition: transform 1s var(--ease-expo-out);
}
.pf-cover--logo:not(.is-transparent) img { padding: 0; object-fit: cover; }
.pf-card__media:hover .pf-cover--logo img { transform: scale(1.05); }

/* screen: the home page's laptop, with the site masked inside it. Same
   geometry as .project-media--framed on the home page: the mockup fills a
   958:578 box and the screen opening is 83.3% wide, 96.5% tall, 1.6% down. */
.pf-cover--screen { background: #ebeae7; }
.laptop {
  position: relative;
  display: block;
  aspect-ratio: 958 / 578;
}
.pf-cover--screen .laptop {
  position: absolute; left: 50%; top: 50%;
  width: 84%;
  transform: translate(-50%, -50%);
}
.laptop-frame {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: url("images/MachBookWebMockup.png") center / contain no-repeat;
}
.screen-window {
  position: absolute; z-index: 1;
  top: 1.6%; left: 50%;
  width: 83.3%; height: 96.5%;
  transform: translateX(-50%);
  overflow: hidden;
  border-radius: 2px;
  background: #fff;
}
/* a full-page strip scrolls; a single screenshot fills the screen from the top */
.screen-window img:not(.is-strip) { height: 100%; object-fit: cover; object-position: top; }
.screen-window img { width: 100%; height: auto; display: block; transition: transform 5s cubic-bezier(0.45, 0, 0.55, 1); }
/* hover scrolls the site inside the screen, like the home page does on scroll;
   --shift is set by JS from the image and window heights */
.pf-card__media:hover .screen-window img { transform: translateY(calc(-1px * var(--shift, 0))); }
@media (prefers-reduced-motion: reduce) { .pf-card__media:hover .screen-window img { transform: none; } }

.pf-card__count {
  position: absolute; left: 12px; bottom: 12px;
  padding: 5px 9px;
  border-radius: 2px;
  background: rgba(34, 34, 34, 0.78);
  color: #f4f4f4;
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.35s var(--ease-quart-out), transform 0.35s var(--ease-quart-out);
}
.pf-card__media:hover .pf-card__count,
.pf-card__media:focus-visible .pf-card__count { opacity: 1; transform: none; }
@media (hover: none) { .pf-card__count { opacity: 1; transform: none; } }

.pf-card__body { padding-top: 14px; }
.pf-card__title {
  font-family: var(--font-serif);
  font-size: 22px; font-weight: 400; line-height: 1.2;
  color: var(--color-text-primary);
}
.pf-card__labels {
  padding-top: 6px;
  font-size: 11px; line-height: 1.5; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--color-text-tertiary);
}

.at-button {
  display: inline-flex; align-items: center; justify-content: center;
  height: 50px; padding: 0 24px;
  border: 1px solid currentColor; border-radius: 2px;
  background: transparent; color: var(--color-text-primary);
  font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none;
  cursor: pointer;
  transition: background-color 0.3s var(--ease-quart-out), color 0.3s var(--ease-quart-out), border-color 0.3s var(--ease-quart-out);
}
.at-button::after { content: "\2192"; margin-left: 8px; transition: transform 0.3s var(--ease-quart-out); }
.at-button:hover::after { transform: translateX(4px); }
.pf-link {
  padding: 4px 0; border-bottom: 1px solid var(--color-border);
  font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none;
  color: var(--color-text-secondary);
  transition: color 0.3s var(--ease-quart-out), border-color 0.3s var(--ease-quart-out);
}
.pf-link:hover { color: var(--color-accent); border-color: var(--color-accent); }

/* ---- Contact footer (home composition) ------------------------------------- */
.pf-contact {
  position: relative;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 20px 90px;
  text-align: center;
  border-top: 1px solid var(--color-border);
}
.pf-contact__center { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.pf-contact__logo img { width: auto; height: clamp(120px, 20vh, 188px); margin-bottom: 24px; }
.pf-contact__name { font-family: var(--font-serif); font-size: 24px; color: #222; }
.pf-contact__location { font-size: 18px; color: #333; }
.pf-contact__email { font-size: 18px; font-weight: 300; color: #333; text-decoration: none; transition: color 0.2s var(--ease-quart-out); }
.pf-contact__email:hover { color: var(--color-accent); }
.pf-contact__copyright {
  position: absolute; left: 20px; right: 20px; bottom: 20px;
  font-size: 12px; font-weight: 300; line-height: 1.5; color: #777;
}

@media (max-width: 768px) {
  :root { --gutter: 20px; }
  /* 64px on the left keeps content clear of the fixed logo and email icon */
  .pf-header, .pf-filters__inner, .pf-grid-wrap { padding-left: 64px; }
  .fixed-logo { left: 14px; }
  .fixed-email { left: 4px; width: 44px; }
  .fixed-email img { width: 34px; }
  .pf-contact__copyright { left: 56px; right: 56px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .pf-card.is-entering { animation: none; }
  .pf-card__media img { transition: none; }
}

/* ==========================================================================
   LIGHTBOX
   Native <dialog>. Left: the project's images and videos, one at a time, with
   arrows, a position counter and a thumbnail strip. Right: the project copy
   and project-to-project navigation. Stacked on phones.
   ========================================================================== */
body.lb-open { overflow: hidden; }

.lb {
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: #1b1b1b; color: #f4f4f4;
  --color-text-primary: #f4f4f4;
  --color-text-secondary: #c9c9c9;
  --color-text-tertiary: #969696;
  --color-border: rgba(244, 244, 244, 0.22);
}
.lb[open] {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 28vw, 400px);
  animation: lbIn 0.45s var(--ease-expo-out);
}
.lb::backdrop { background: rgba(17, 17, 17, 0.6); }
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }

.lb__stage {
  position: relative; min-width: 0; min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  padding: clamp(48px, 5vw, 64px) clamp(64px, 6vw, 96px) 18px;
}
.lb__media {
  min-height: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: auto;
  overscroll-behavior: contain;
}
.lb__media > img,
.lb__media > video {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  border-radius: 3px;
  animation: lbItem 0.5s var(--ease-expo-out);
}
.lb__media > video { background: #111; }
@keyframes lbItem { from { opacity: 0; } to { opacity: 1; } }
/* the website strips are 250px masters: 1.5x is the most they take before going soft */
/* logo item: the mark on a light panel, since most logos are dark on transparent */
.lb__logo {
  display: grid; place-items: center;
  width: min(100%, 900px); height: 100%; max-height: 640px;
  border-radius: 3px;
  background: #f4f4f4;
  animation: lbItem 0.5s var(--ease-expo-out);
}
.lb__logo img { max-width: 70%; max-height: 70%; object-fit: contain; }
.lb__logo.is-photo img { max-width: 100%; max-height: 100%; }

/* screen item: the laptop at full stage size, the site scrollable inside it */
.lb__media > .laptop {
  width: min(100%, calc((100dvh - 190px) * 958 / 578), 1100px);
  animation: lbItem 0.5s var(--ease-expo-out);
}
.lb__media > .laptop .screen-window {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.lb__media > .laptop .screen-window::-webkit-scrollbar { display: none; }
.lb__media > .laptop .screen-window img { transition: none; }

.lb__step {
  position: absolute; top: 50%; z-index: 2;
  width: 48px; height: 48px; margin-top: -40px;
  border: 1px solid var(--color-border); border-radius: 50%;
  background: rgba(27, 27, 27, 0.6); color: #f4f4f4;
  font-size: 18px; cursor: pointer;
  transition: border-color 0.3s var(--ease-quart-out), color 0.3s var(--ease-quart-out);
}
.lb__step:hover { border-color: var(--color-accent); color: var(--color-accent); }
.lb__step--prev { left: clamp(8px, 1.5vw, 24px); }
.lb__step--next { right: clamp(8px, 1.5vw, 24px); }

.lb__position {
  position: absolute; top: 20px; left: clamp(16px, 1.5vw, 24px);
  font-size: 12px; letter-spacing: 0.06em; color: var(--color-text-tertiary);
  font-variant-numeric: tabular-nums;
}

.lb__thumbs {
  display: flex; gap: 8px; justify-content: safe center;
  padding-top: 16px;
  overflow-x: auto; scrollbar-width: thin;
}
.lb__thumbs button {
  position: relative;
  flex: 0 0 auto;
  width: 72px; height: 50px; padding: 0;
  border: 1px solid transparent; border-radius: 3px;
  overflow: hidden; background: #2a2a2a; cursor: pointer; opacity: 0.5;
  transition: opacity 0.3s var(--ease-quart-out), border-color 0.3s var(--ease-quart-out);
}
.lb__thumbs button img { width: 100%; height: 100%; object-fit: cover; }
.lb__thumbs button.is-video::after {
  content: "\25B6";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 12px; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}
.lb__thumbs button:hover, .lb__thumbs button[aria-current="true"] { opacity: 1; border-color: var(--color-accent); }

.lb__panel {
  display: flex; flex-direction: column;
  padding: clamp(64px, 9vh, 96px) clamp(24px, 2.6vw, 40px) 26px;
  background: #222;
  overflow-y: auto;
}
.lb__eyebrow { font-size: 11px; line-height: 1.6; letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-accent); }
.lb__title { margin-top: 10px; font-family: var(--font-serif); font-size: clamp(28px, 2.3vw, 36px); font-weight: 400; line-height: 1.12; }
.lb__sub { margin-top: 8px; font-family: var(--font-serif); font-size: 18px; line-height: 1.3; color: var(--color-text-secondary); }
.lb__stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 24px; }
.lb__stats p { padding-top: 12px; border-top: 1px solid var(--color-border); font-size: 13px; line-height: 1.45; color: var(--color-text-secondary); }
.lb__stats strong { display: block; margin-top: 2px; font-size: 17px; font-weight: 600; color: var(--color-accent); }
/* Credits, so they sit as one block rather than as separate sentences. Same
   reasoning and the same leading as .project-tags on the home page. */
.lb__tags { display: flex; flex-direction: column; gap: 1px; margin-top: 22px; }
.lb__tags p { font-size: 13.5px; font-weight: 300; line-height: 1.32; color: var(--color-text-secondary); }
.lb__tags strong { font-weight: 600; color: var(--color-text-primary); }
.lb__detail { margin-top: 20px; font-size: 14.5px; font-weight: 300; line-height: 1.7; color: var(--color-text-secondary); }
.lb__links { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-top: 26px; }
.lb__links:empty { display: none; }
.lb .at-button:hover { background: #f4f4f4; color: #222; border-color: #f4f4f4; }

.lb__nav {
  margin-top: auto; padding-top: 26px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-top: 1px solid var(--color-border);
}
.lb__nav button {
  display: inline-flex; align-items: center; gap: 8px;
  max-width: 42%;
  padding: 10px 0; border: 0; background: none; cursor: pointer;
  font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-primary);
  transition: color 0.3s var(--ease-quart-out);
}
.lb__nav button span:not([aria-hidden]) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb__nav button:hover { color: var(--color-accent); }
.lb__count { font-size: 12px; color: var(--color-text-tertiary); font-variant-numeric: tabular-nums; }

.lb__close {
  position: absolute; top: 18px; right: 18px; z-index: 3;
  width: 44px; height: 44px; border: 1px solid var(--color-border); border-radius: 50%;
  background: rgba(34, 34, 34, 0.7); color: #f4f4f4; cursor: pointer;
  font-size: 24px; line-height: 1;
  transition: border-color 0.3s var(--ease-quart-out), color 0.3s var(--ease-quart-out);
}
.lb__close:hover { border-color: var(--color-accent); color: var(--color-accent); }

@media (max-width: 860px) {
  .lb[open] { grid-template-columns: 1fr; grid-template-rows: auto auto; overflow-y: auto; }
  .lb__stage { height: 62dvh; padding: 52px 12px 10px; }
  .lb__step { top: auto; bottom: 76px; margin-top: 0; width: 40px; height: 40px; }
  .lb__step--prev { left: 12px; }
  .lb__step--next { right: 12px; }
  .lb__position { top: 22px; left: 16px; }
  .lb__thumbs { padding-top: 10px; }
  .lb__thumbs button { width: 60px; height: 42px; }
  .lb__panel { padding: 24px 22px 0; overflow: visible; }
  .lb__nav { position: sticky; bottom: 0; background: #222; padding-bottom: 10px; }
  .lb__close { top: 10px; right: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .lb[open], .lb__media > img, .lb__media > video { animation: none; }
}
