/* ==========================================================================
   Tokens (values from the Figma file)
   ========================================================================== */
/* Light theme: values from the Figma frame "Portfolio/web-2" (Design_playground). */
:root {
  --bg: #f0f2fb;
  --text: #0f1010;
  --text-2: #54565c;
  --text-3: #7f828a;
  --card: #dce3f1;
  --pill-bg: #ffffff;
  --pill-border: #e6e9f0;
  --icon: #7f828a;
  --icon-active: #141b34;
  --icon-hover-bg: #f0f2fb;
  --btn-bg: #ffffff;
  --btn-text: #1c1d1f;
  --btn-border: #e6e9f0;
  --tooltip-bg: #ffffff;
  --tooltip-text: #1c1d1f;
  --tooltip-border: #e6e9f0;
  --focus: #0076ff;

  --radius-card: 16px;
  --radius-avatar: 18px;
  --radius-pill: 99px;

  --card-tall: 308px;
  --card-short: 200px;
  --grid-gap: 16px;

  /* Motion: a strong ease-out for things arriving or leaving, a strong ease-in-out for
     things moving or resizing on screen (emil-design-eng). Never ease-in on UI. */
  --ease-arrive: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-travel: cubic-bezier(0.77, 0, 0.175, 1);
  --dur-press: 160ms;
  --dur-tooltip: 150ms;

  color-scheme: light;
}

/* Dark theme: values from the Figma frame "Portfolio/web-4". */
:root[data-theme="dark"] {
  --bg: #202122;
  --text: #e2e3e9;
  --text-2: #74777a;
  --text-3: #74777a;
  --card: #dce3f1;
  --pill-bg: #3c3d3e;
  --pill-border: #494b50;
  --icon: #919199;
  --icon-active: #e2e3e9;
  --icon-hover-bg: #202122;
  --btn-bg: #3c3d3e;
  --btn-text: #e2e3e9;
  --btn-border: #494b50;
  --tooltip-bg: #3c3d3e;
  --tooltip-text: #ffffff;
  --tooltip-border: #494b50;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #202122;
    --text: #e2e3e9;
    --text-2: #74777a;
    --text-3: #74777a;
    --card: #dce3f1;
    --pill-bg: #3c3d3e;
    --pill-border: #494b50;
    --icon: #919199;
    --icon-active: #e2e3e9;
    --icon-hover-bg: #202122;
    --btn-bg: #3c3d3e;
    --btn-text: #e2e3e9;
    --btn-border: #494b50;
    --tooltip-bg: #3c3d3e;
    --tooltip-text: #ffffff;
    --tooltip-border: #494b50;
    color-scheme: dark;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, p { margin: 0; }
img, svg { display: block; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
/* Touch: no grey flash on tap, no double-tap-zoom delay, no text selection on long-press. */
a, button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button, .card, .book-btn, .icon-btn { -webkit-user-select: none; user-select: none; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ==========================================================================
   Page layout: desktop (1200px and up)
   [profile 260] [gap] [grid] [gap] [rail 50]
   At 1440px the gaps are 80 / 130, which puts the grid at x=420 and 760px wide (as in Figma).
   ========================================================================== */
.page {
  --gap-left: clamp(40px, calc(40px + (100vw - 1200px) / 6), 80px);
  --gap-right: clamp(80px, calc(80px + (100vw - 1200px) * 0.2083), 130px);

  display: grid;
  grid-template-columns: 260px var(--gap-left) minmax(0, 1fr) var(--gap-right) 50px;
  grid-template-areas: "profile . projects . rail";
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 80px;
}

/* --- Profile column (sticky) --- */
.profile {
  grid-area: profile;
  align-self: start;
  position: sticky;
  top: 56px;
  margin-top: 56px;
  height: calc(100vh - 96px);   /* 56 top + 40 bottom */
  height: calc(100dvh - 96px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  overflow-y: auto;
  scrollbar-width: none;
}
.profile::-webkit-scrollbar { display: none; }

.profile__intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
  min-width: 0;
}

.avatar {
  position: relative;
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-avatar);
  overflow: hidden;
}
.avatar img {
  position: absolute;
  left: -7.69px;
  top: -10.87px;
  width: 71.236px;
  height: 89.067px;
  max-width: none;
  object-fit: cover;
}

.profile__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  width: 260px;
  max-width: 100%;
}

.profile__name {
  font-size: 18px;
  line-height: 19.8px;
  font-weight: 600;
  color: var(--text);
}

.bio {
  position: relative;
  font-size: 15px;
  line-height: 21px;
  color: var(--text-2);
  overflow-wrap: break-word;
  /* 235px sets the first paragraph as
       I design mobile apps, websites, / and brands that bring together /
       functionality, aesthetics, and / business thinking.
     ("and" starts line 2, "business thinking." stays together). Measured in Geist 15px:
     229–241px give these breaks; 235 is the middle, so font rendering differences
     between systems don't shift them. */
  max-width: 235px;
  text-wrap: pretty;   /* backup: avoids one-word last lines at narrower widths */
}
.bio p + p { margin-top: 21px; }

/* Collapsed: 79px tall with a fade, as in the Figma "Collapse" variant.
   The fade stays in the DOM and eases out/in as the bio opens and closes. */
.bio.is-collapsed {
  max-height: 79px;
  overflow: hidden;
  cursor: pointer;
}
.bio::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 79px;
  background: linear-gradient(180deg, transparent 0%, var(--bg) 105.06%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 340ms var(--ease-travel);   /* same timing family as the height morph */
}
.bio.is-collapsed::after { opacity: 1; }

.bio-toggle__word { display: inline-block; }

.bio-toggle {
  font-size: 15px;
  line-height: 21px;
  color: var(--text-2);
  border-radius: 4px;
  transition: color 150ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .bio-toggle:hover { color: var(--text); }
}

.profile__footer {
  font-size: 13px;
  line-height: 15.6px;
  color: var(--text-3);
}

/* --- Projects --- */
.projects {
  grid-area: projects;
  min-width: 0;
  padding: 164px 0 80px;
}

.grid {
  --cols: 3;
  display: flex;
  align-items: flex-start;
  gap: var(--grid-gap);
}
.grid__col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--grid-gap);
}

.card {
  position: relative;
  display: block;
  height: var(--card-tall);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--card);
  cursor: zoom-in;
  transition: transform var(--dur-press) var(--ease-arrive);
}
.card--short { height: var(--card-short); }
.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 500ms var(--ease-arrive);
}

/* Press: a quick, small give under the pointer before the lightbox opens.
   Big surfaces need less scale than buttons to read as the same press. */
.card:active { transform: scale(0.98); }

/* Hover (fine pointers only, so a tap never leaves a card stuck zoomed) */
@media (hover: hover) and (pointer: fine) {
  .card:hover img { transform: scale(1.035); }
}

/* Entrance: cards rise into place as they scroll into view (script.js adds .is-in and
   a per-card --delay). Delays shrink down the group, so it reads as a wave, not a metronome.
   They are opaque within the first third, so a card never reads as a ghost. */
.grid.is-revealing .card:not(.is-in) { opacity: 0; }
.card.is-in:not(.is-done) {
  animation: card-in 650ms var(--ease-arrive) backwards;
  animation-delay: var(--delay, 0ms);
}
@keyframes card-in {
  0%   { opacity: 0; transform: translateY(20px); }
  35%  { opacity: 1; }
  100% { opacity: 1; transform: none; }
}

/* --- Right rail: Book a call + dock --- */
.rail {
  grid-area: rail;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
}

.book-btn {
  position: sticky;
  top: 66px;
  margin-top: 66px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  box-shadow: inset 0 0 0 1px var(--btn-border);
  color: var(--btn-text);
  font-size: 13px;
  line-height: 15.6px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 150ms ease, transform var(--dur-press) var(--ease-arrive);
}
.book-btn:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .book-btn:hover { opacity: 0.85; }
}

.dock-slot {
  position: sticky;
  bottom: 40px;
  margin: 24px 0 40px;
  z-index: 5;
}

.dock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 50px;
}

.pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 50px;
  padding: 4px 0;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  border-radius: var(--radius-pill);
}

.icon-btn {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--icon);
  text-decoration: none;
  transition: background-color 150ms ease, color 150ms ease, transform var(--dur-press) var(--ease-arrive);
  /* Appearing icons arrive just after their pill starts to grow (content after container). */
  animation: pop-in 220ms var(--ease-arrive) 60ms backwards;
}
.icon-btn:active { transform: scale(0.94); }
/* Leaving icons fade out (faster than they came in) before the pill shrinks around them. */
.icon-btn.is-leaving {
  animation: pop-out 120ms var(--ease-arrive) forwards;
  pointer-events: none;
}

/* Hidden items inside the pills */
.dock.is-social-collapsed .pill--social [data-role="social"] { display: none; }
.pill--theme:not(.is-open) .icon-btn:not(.is-current) { display: none; }

/* Highlight: hover (mouse) and the current theme while the menu is open */
.pill--theme.is-open .icon-btn.is-current {
  background: var(--icon-hover-bg);
  color: var(--icon-active);
}

/* Tooltips: shown 8px to the left of the pill, only on devices with a mouse */
.tooltip {
  position: absolute;
  right: calc(100% + 13px);       /* 5px icon inset + 8px gap */
  top: 50%;
  transform: translate(4px, -50%) scale(0.97);
  transform-origin: right center;   /* grows out of the icon it labels */
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: var(--tooltip-bg);
  box-shadow: inset 0 0 0 1px var(--tooltip-border);
  color: var(--tooltip-text);
  font-size: 13px;
  line-height: 15.6px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  /* Hiding: quick, no wait */
  transition:
    opacity 100ms var(--ease-arrive),
    transform 100ms var(--ease-arrive),
    visibility 0s 100ms;
}

@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover {
    background: var(--icon-hover-bg);
    color: var(--icon-active);
  }
  .icon-btn:hover .tooltip {
    opacity: 1;
    visibility: visible;
    transform: translate(0, -50%);
    /* Showing: a short wait, so sweeping across the dock doesn't flash every label */
    transition:
      opacity var(--dur-tooltip) var(--ease-arrive) 250ms,
      transform var(--dur-tooltip) var(--ease-arrive) 250ms,
      visibility 0s 250ms;
  }
  /* Once one tooltip has shown, its neighbours appear instantly (script.js sets this). */
  .dock.is-tooltip-warm .tooltip { transition: none; }
}
/* Keyboard focus: show the label straight away */
.icon-btn:focus-visible .tooltip {
  opacity: 1;
  visibility: visible;
  transform: translate(0, -50%);
  transition: opacity var(--dur-tooltip) var(--ease-arrive), transform var(--dur-tooltip) var(--ease-arrive);
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.9); }
}
@keyframes pop-out {
  to { opacity: 0; transform: scale(0.9); }
}

/* ==========================================================================
   Page entrance: profile in reading order, then the rail. Cards are handled above.
   ========================================================================== */
/* The name leads and travels furthest; supporting pieces travel less; chrome (button,
   footer) only fades. Gaps shrink down the column so it reads as one wave. */
.avatar,
.profile__name,
.bio,
.bio-toggle,
.book-btn,
.dock,
.profile__footer {
  animation: enter 600ms var(--ease-arrive) backwards;
  animation-delay: var(--enter-delay, 0ms);
}
.avatar          { --enter-delay:  40ms; --rise: 8px; }
.profile__name   { --enter-delay:  90ms; --rise: 12px; }
.book-btn        { --enter-delay: 120ms; --rise: 0px; }
.bio             { --enter-delay: 160ms; --rise: 8px; }
.bio-toggle      { --enter-delay: 210ms; --rise: 6px; }
.dock            { --enter-delay: 260ms; --rise: 6px; }
.profile__footer { --enter-delay: 290ms; --rise: 0px; }

@keyframes enter {
  from { opacity: 0; transform: translateY(var(--rise, 8px)); }
}
@keyframes fade-in  { from { opacity: 0; } }
@keyframes fade-out { to   { opacity: 0; } }

/* Theme switch: a short crossfade of the whole page (View Transitions, where supported).
   The overlay lets the pointer through, so the hover menu doesn't close mid-fade. */
::view-transition { pointer-events: none; }
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.25s;
  animation-timing-function: ease;
}

/* ==========================================================================
   Stacked layouts (below 1200px): profile on top, grid below,
   footer + dock at the bottom. Values from the 920px Figma frame.
   ========================================================================== */
@media (max-width: 1199px) {
  .page {
    --pad-top: 56px;
    --pad-x: 80px;
    --pad-bottom: 40px;
    --gap-grid: 64px;
    --gap-dock: 56px;
    --dock-h: 238px;               /* full social pill (176) + 12 + theme button (50) */

    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "intro    book"
      "projects projects"
      "footer   dock";
    column-gap: 16px;
    max-width: none;
    padding: var(--pad-top) var(--pad-x) var(--pad-bottom);
  }

  .profile,
  .rail { display: contents; }

  .profile__intro { grid-area: intro; }

  .book-btn {
    grid-area: book;
    align-self: start;
    position: static;
    margin-top: 10px;              /* centres it on the 56px avatar */
  }

  .projects {
    padding: 0;
    margin-top: var(--gap-grid);
  }

  .profile__footer {
    grid-area: footer;
    align-self: end;
  }

  /* The dock sits in the page flow; menus open upwards over the space above. */
  .dock-slot {
    grid-area: dock;
    align-self: end;
    justify-self: end;
    position: relative;
    bottom: auto;
    width: 50px;
    height: var(--dock-h);
    margin: var(--gap-dock) 0 0;
  }
  .dock {
    position: absolute;
    right: 0;
    bottom: 0;
  }
  .dock .pill { box-shadow: 0 8px 24px rgba(15, 16, 16, 0.06); }
}

/* Tablet (tab.png, 744px): 2 columns, social pill collapsed to the mailbox button */
@media (max-width: 899px) {
  .page {
    --pad-top: 48px;
    --pad-x: 48px;
    --pad-bottom: 40px;
    --gap-grid: 40px;
    --gap-dock: 40px;
    --dock-h: 112px;               /* mailbox (50) + 12 + theme button (50) */
  }
  .grid { --cols: 2; }
}

/* Mobile (mobile.png, 412px): 1 column */
@media (max-width: 599px) {
  .page {
    --pad-top: 16px;
    --pad-x: 16px;
    --pad-bottom: 16px;
    --gap-grid: 40px;
    --gap-dock: 32px;
  }
  .grid { --cols: 1; }
}

/* Reduced motion: fewer and gentler, not none. Movement goes; short fades that explain
   what appeared or changed stay, without staggers. */
@media (prefers-reduced-motion: reduce) {
  .avatar,
  .profile__name,
  .bio,
  .bio-toggle,
  .book-btn,
  .dock,
  .profile__footer { animation: fade-in 200ms ease backwards; }
  .icon-btn { animation: fade-in 150ms ease backwards; }
  .icon-btn.is-leaving { animation: fade-out 100ms ease forwards; }
  .card:active,
  .card:hover img,
  .book-btn:active,
  .icon-btn:active { transform: none; }
  .tooltip,
  .icon-btn:hover .tooltip { transform: translate(0, -50%); }
}

/* ==========================================================================
   Lightbox (PhotoSwipe), from the Figma frame "Portfolio/web-1" (node 304:31075).
   The page stays faintly visible behind an 86% black, 8px blur backdrop.
   Controls are the dark dock pills; the lightbox is dark in both themes.
   ========================================================================== */
.pswp {
  --pswp-bg: #000;                       /* opacity 0.86 comes from bgOpacity in script.js */
  --lb-pill-bg: #3c3d3e;
  --lb-pill-border: #494b50;
  --lb-thumb-bg: #3e4043;
  --lb-thumb-active: #5a5b5f;
  --lb-inset: 40px;                      /* close and arrows sit 40px from the edges */
  --lb-thumb: 80px;
  --lb-thumb-radius: 16px;
  --lb-thumb-gap: 16px;
  --lb-strip-w: 464px;                   /* five thumbnails; the outer two fade out */
  --lb-strip-bottom: 50px;
  font-family: "Geist", ui-sans-serif, system-ui, sans-serif;
}
/* The blur sits on the root: PhotoSwipe's will-change/transform on .pswp stop its inner
   layers from seeing the page. It eases in and out with the open/close zoom
   (script.js toggles .is-blurred on PhotoSwipe's opening/closing events). */
.pswp {
  -webkit-backdrop-filter: blur(0px);
  backdrop-filter: blur(0px);
  transition:
    -webkit-backdrop-filter var(--pswp-transition-duration, 333ms) cubic-bezier(0.4, 0, 0.22, 1),
    backdrop-filter var(--pswp-transition-duration, 333ms) cubic-bezier(0.4, 0, 0.22, 1);
}
.pswp.is-blurred {
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

/* The slide image has the cards' 16px corners, so the zoom from a card reads as one shape. */
.pswp__img { border-radius: 16px; }

/* --- Round buttons: close, previous, next --- */
.pswp .pswp__button--close,
.pswp .pswp__button--arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  margin: 0;
  border-radius: 99px;
  background: var(--lb-pill-bg);
  box-shadow: inset 0 0 0 1px var(--lb-pill-border);
  overflow: visible;
}
/* The close button's own opacity stays 1: it fades with the top bar around it.
   The arrows keep PhotoSwipe's hide-on-close opacity, so they fade with the rest of the UI. */
.pswp .pswp__button--close {
  opacity: 1;
  transition: transform var(--dur-press) var(--ease-arrive);
}
.pswp .pswp__button--arrow {
  transition:
    opacity var(--pswp-transition-duration, 333ms) cubic-bezier(0.4, 0, 0.22, 1),
    transform var(--dur-press) var(--ease-arrive);
}
.pswp .pswp__button--close:active,
.pswp .pswp__button--arrow:active { transform: scale(0.94); }
.pswp .pswp__button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Closing: the controls leave first and fast, so none of them trail the image
   as it zooms back into its card. */
.pswp:not(.pswp--ui-visible) .pswp__hide-on-close,
.pswp:not(.pswp--ui-visible) .pswp__button--arrow { transition-duration: 100ms; }

/* The 40px icon area inside each pill */
.lb-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}
.lb-icon img { transition: opacity 150ms ease, filter 150ms ease; }
/* Close hover (Figma 306:31268): the X turns white. The white icon sits on top and fades in. */
.lb-icon .lb-icon__hover {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
}

/* Close tooltip (Figma 306:31273): 8px left of the button, the dock's tooltip motion */
.lb-tooltip {
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  transform: translate(4px, -50%) scale(0.97);
  transform-origin: right center;
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border-radius: 99px;
  background: var(--lb-pill-bg);
  box-shadow: inset 0 0 0 1px var(--lb-pill-border);
  color: #fff;
  font-size: 13px;
  line-height: 15.6px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 100ms var(--ease-arrive),
    transform 100ms var(--ease-arrive),
    visibility 0s 100ms;
}

@media (hover: hover) and (pointer: fine) {
  .pswp__button--close:hover .lb-icon__hover { opacity: 1; }
  /* Arrows have no hover state in the design; they get the same white icon */
  .pswp__button--arrow:hover .lb-icon img { filter: brightness(0) invert(1); }
  .pswp__button--close:hover .lb-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translate(0, -50%);
    transition:
      opacity var(--dur-tooltip) var(--ease-arrive) 250ms,
      transform var(--dur-tooltip) var(--ease-arrive) 250ms,
      visibility 0s 250ms;
  }
}
.pswp__button--close:focus-visible .lb-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translate(0, -50%);
}

/* Close: top right */
.pswp .pswp__top-bar {
  height: auto;
  padding: var(--lb-inset) var(--lb-inset) 0 0;
}

/* Arrows: centred on the left and right edges */
.pswp .pswp__button--arrow {
  top: 50%;
  margin-top: -25px;
}
.pswp .pswp__button--arrow--prev { left: var(--lb-inset); right: auto; }
.pswp .pswp__button--arrow--next { right: var(--lb-inset); left: auto; }
/* First and last image: nothing before / after, so no arrow (Figma comments on "Update").
   PhotoSwipe disables the arrow at each end because the gallery doesn't loop. */
.pswp .pswp__button--arrow:disabled { display: none; }

/* --- Thumbnail strip (Figma "Update" frames): the active thumbnail sits in the middle,
   except at the ends, where the strip rests at its edge (first image = leftmost
   thumbnail, last image = rightmost). The ends fade out. --- */
.pswp__thumbs {
  position: absolute;
  left: 50%;
  bottom: calc(var(--lb-strip-bottom) + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: var(--lb-strip-w);
  max-width: calc(100% - 32px);
  height: var(--lb-thumb);
  display: flex;
  gap: var(--lb-thumb-gap);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  touch-action: pan-x;               /* swipe the strip; the browser scrolls it natively */
  scroll-snap-type: x proximity;      /* a swipe settles with a thumbnail in the centre */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, transparent 15px, #000 67px, #000 calc(100% - 64px), transparent calc(100% - 14px));
  mask-image: linear-gradient(90deg, transparent 0, transparent 15px, #000 67px, #000 calc(100% - 64px), transparent calc(100% - 14px));
}
.pswp__thumbs::-webkit-scrollbar { display: none; }
/* Fewer thumbnails than fit: the row sits centred in the strip (auto margins
   collapse to 0 once it overflows, so scrolling still starts at the first one). */
.pswp__thumb:first-child { margin-left: auto; }
.pswp__thumb:last-child { margin-right: auto; }

.pswp__thumb {
  position: relative;
  flex: 0 0 auto;
  width: var(--lb-thumb);
  height: var(--lb-thumb);
  border-radius: var(--lb-thumb-radius);
  overflow: hidden;
  background: var(--lb-thumb-bg);
  scroll-snap-align: center;
  transition: transform var(--dur-press) var(--ease-arrive);
}
/* The 1px border sits above the image, inside the rounded corners */
.pswp__thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow 150ms ease;
  pointer-events: none;
}
.pswp__thumb.is-active::after { box-shadow: inset 0 0 0 1px var(--lb-thumb-active); }
.pswp__thumb:active { transform: scale(0.95); }
.pswp__thumb:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.pswp__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* Tablet: controls closer to the edges */
@media (max-width: 899px) {
  .pswp { --lb-inset: 24px; }
}

/* Phones and touch screens: no arrows. Swipe the image, or pick from the strip. */
@media (max-width: 599px), (hover: none) {
  .pswp .pswp__button--arrow { display: none; }
}

/* Mobile: smaller thumbnails, close button 16px in */
@media (max-width: 599px) {
  .pswp {
    --lb-inset: 16px;
    --lb-thumb: 56px;
    --lb-thumb-radius: 12px;
    --lb-thumb-gap: 12px;
    --lb-strip-bottom: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pswp .pswp__button--close:active,
  .pswp .pswp__button--arrow:active,
  .pswp__thumb:active { transform: none; }
}
