/* YI LIU — white gallery photo wall.
   Motion comes from the ui-motion-library effect collection, adapted to this site:
     03-motion/01 Fade         thumbnails fade in once loaded (300ms ease-in-out, opacity only)
     06-cards/10  Masonry      tiles rise in one after another on load and on every filter switch
     06-cards/02  Media Card   on hover the photo grows inside its frame (scale reduced to 1.03)
     01-buttons/04 Text Button underline grows from the left on hover; the current filter keeps it
     01-buttons/17 Focus       keyboard focus ring with :focus-visible */

:root {
  --bg: #FAFAF8;
  --ink: #1F2328;
  --muted: #6B7075;
  --tint: #EEEDE9;            /* stands in for a photo until it has loaded */
  --gutter: 48px;             /* page side margin */
  --page-width: 1600px;
  --masthead-top: 64px;
  --masthead-gap: 120px;      /* space between the top bar and the wall */
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC",
    "Noto Sans SC", sans-serif;
}

@media (max-width: 767px) {
  :root {
    --gutter: 12px;
    --masthead-top: 32px;
    --masthead-gap: 56px;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scrollbar-gutter: stable;   /* the wall keeps its width when the scrollbar comes and goes */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 300 15px/1.75 var(--sans);
}

a { color: inherit; }

:focus-visible {
  outline: 2.5px solid var(--ink);
  outline-offset: 3px;
}

.masthead,
.notice,
.wall,
.page {
  width: min(100% - 2 * var(--gutter), var(--page-width));
  margin-inline: auto;
}

/* ---------------------------------------------------------------- top bar */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px 48px;
  padding-top: var(--masthead-top);
  margin-bottom: var(--masthead-gap);
}

.site-name {
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.42em;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav,
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 28px;
}

.site-nav {
  column-gap: 40px;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.nav-item {
  position: relative;
  padding: 4px 0;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s;
}

.nav-item::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.15s;
}

.nav-item:hover,
.nav-item[aria-pressed="true"],
.nav-item[aria-current="page"] {
  color: var(--ink);
}

.nav-item:hover::after,
.nav-item[aria-pressed="true"]::after,
.nav-item[aria-current="page"]::after {
  transform: scaleX(1);
}

/* ---------------------------------------------------------------- wall */

.notice {
  margin-top: 0;
  margin-bottom: var(--masthead-gap);
  color: var(--muted);
}

.wall {
  position: relative;         /* app.js places every tile and sets the height */
  margin-bottom: var(--masthead-gap);
}

.photo {
  position: absolute;
  display: block;
  overflow: hidden;
  background: var(--tint);
  animation: wall-rise 0.4s calc(var(--i, 0) * 60ms) cubic-bezier(0.2, 0.9, 0.3, 1) backwards;
}

.photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s ease-in-out, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.photo.is-loaded img { opacity: 1; }

@media (hover: hover) {
  .photo:hover img { transform: scale(1.03); }
}

@keyframes wall-rise {
  from { opacity: 0; transform: translateY(14px); }
}

/* ---------------------------------------------------------------- about and 404 */

.page { margin-bottom: var(--masthead-gap); }

.page > * { max-width: 34em; }

.page h1 {
  margin: 0 0 32px;
  font-size: 20px;
  font-weight: 300;
  letter-spacing: 0.12em;
}

.page p { margin: 0 0 1.2em; }

.page a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* ---------------------------------------------------------------- lightbox (PhotoSwipe) */

.pswp {
  --pswp-bg: var(--bg);
  --pswp-placeholder-bg: var(--tint);
  --pswp-icon-color: var(--ink);
  --pswp-icon-color-secondary: var(--bg);
  --pswp-icon-stroke-color: var(--bg);
  --pswp-preloader-color: rgba(31, 35, 40, 0.15);
  --pswp-preloader-color-secondary: rgba(31, 35, 40, 0.7);
}

.pswp__counter {
  font-family: var(--sans);
  font-weight: 300;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-shadow: none;
}

/* ---------------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  .photo { animation: none; }
  .photo img,
  .nav-item,
  .nav-item::after { transition: none; }
  .photo:hover img { transform: none; }
}
