/* Demos listing, in the Walenberg minimal style: white page, Helvetica, small spaced capitals.
   Loaded before /styles.css, so the site's own gallery rules take over wherever they exist. */

html, body {
  margin: 0;
  background: #fff;
  color: #111;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 64px;
}

.demos-header {
  padding: 40px 0 24px;
  text-align: center;
}

.demos-header h1 {
  margin: 16px 0 0;
  font-weight: 400;
  font-size: clamp(18px, 4vw, 32px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.back-link {
  display: inline-block;
  padding: 12px 8px;
  color: #8a8a8a;
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.back-link:hover,
.back-link:focus-visible {
  color: #111;
  outline: none;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 8px 0 28px;
  color: #8a8a8a;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e6e6e6;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 40px 32px;
}

.gallery figure {
  margin: 0;
}

.gallery a {
  display: block;
  color: inherit;
  text-decoration: none;
  outline: none;
}

.gallery picture {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #f4f4f4;
}

.gallery img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.3s ease;
}

.thumb-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: #f4f4f4;
  color: #b5b5b5;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.gallery figcaption {
  margin-top: 14px;
  font-size: 12px;
  line-height: 1.7;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.caption-description {
  display: inline-block;
  margin: 2px 0 4px;
  color: #555;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  text-transform: none;
}

.caption-link {
  color: #8a8a8a;
  font-size: 11px;
  transition: color 0.2s ease;
}

.gallery a:hover img,
.gallery a:focus-visible img {
  transform: scale(1.03);
}

.gallery a:hover .caption-link,
.gallery a:focus-visible .caption-link {
  color: #111;
}

.gallery a:focus-visible figcaption {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* While the particle transition plays: the chosen picture turns into particles,
   everything else steps back */
body.leaving .gallery figure,
body.leaving .demos-header,
body.leaving .section-label {
  transition: opacity 0.5s ease;
  opacity: 0.25;
}

body.leaving .gallery figure.chosen {
  opacity: 1;
}

body.leaving .gallery figure.chosen picture > * {
  opacity: 0;
  transition: opacity 0.25s ease;
}

/* Scroll particles float over the page; clicks pass straight through */
#scroll-particles {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 50;
}

body.particles-on .gallery picture {
  background: transparent;
}

body.particles-on .gallery picture > * {
  will-change: opacity;
}

.demos-footer {
  margin-top: 56px;
  text-align: center;
}

/* Private page password prompt */
.password-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 72px auto;
  max-width: 420px;
}

.password-form label {
  width: 100%;
  text-align: center;
  color: #8a8a8a;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.password-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 2px;
  border: 0;
  border-bottom: 1px solid #ccc;
  background: transparent;
  color: #111;
  font: inherit;
  font-size: 16px;
  outline: none;
}

.password-form input:focus {
  border-bottom-color: #111;
}

.password-form button {
  padding: 10px 14px;
  border: 1px solid #111;
  background: #111;
  color: #fff;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.password-form button:hover,
.password-form button:focus-visible {
  background: #fff;
  color: #111;
}

.password-error {
  width: 100%;
  margin: 4px 0 0;
  text-align: center;
  color: #b3261e;
  font-size: 12px;
}

/* Manage page */
.manage-flash {
  margin: 0 0 24px;
  padding: 10px 14px;
  border-left: 2px solid #111;
  background: #f6f6f6;
  font-size: 13px;
}

.manage-flash.is-error {
  border-left-color: #b3261e;
  color: #b3261e;
}

.manage-row {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  gap: 20px;
  align-items: start;
  padding: 20px 0;
  border-bottom: 1px solid #eee;
}

.manage-add {
  grid-template-columns: 1fr auto;
  margin-bottom: 40px;
}

.manage-row.is-off .manage-thumb {
  opacity: 0.4;
}

.manage-thumb {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #f4f4f4;
}

.manage-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.manage-thumb .thumb-placeholder {
  font-size: 10px;
}

.manage-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  min-width: 0;
}

.manage-fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 220px;
  color: #8a8a8a;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.manage-fields label.wide {
  flex-basis: 100%;
}

.manage-fields label.check {
  flex: 0 0 auto;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  color: #111;
}

.manage-fields input[type="text"],
.manage-fields input:not([type]),
.manage-fields input[type="file"] {
  padding: 6px 2px;
  border: 0;
  border-bottom: 1px solid #ddd;
  background: transparent;
  color: #111;
  font: inherit;
  font-size: 14px;
  letter-spacing: normal;
  text-transform: none;
  outline: none;
  min-width: 0;
}

.manage-fields input:focus {
  border-bottom-color: #111;
}

.manage-meta {
  flex-basis: 100%;
  margin: 0;
  color: #8a8a8a;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.manage-meta a {
  color: inherit;
}

.manage-state {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 8px;
  border: 1px solid currentColor;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.manage-state.state-public { color: #1b6e3a; }
.manage-state.state-private { color: #8a5a00; }
.manage-state.state-off { color: #8a8a8a; }

.manage-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.manage-actions button {
  padding: 10px 14px;
  border: 1px solid #111;
  background: #111;
  color: #fff;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.manage-actions button.quiet {
  background: #fff;
  color: #111;
}

.manage-actions button:hover,
.manage-actions button:focus-visible {
  background: #fff;
  color: #111;
}

.manage-actions button.quiet:hover,
.manage-actions button.quiet:focus-visible {
  background: #b3261e;
  border-color: #b3261e;
  color: #fff;
}

@media (max-width: 640px) {
  .manage-row,
  .manage-add {
    grid-template-columns: 1fr;
  }
  .manage-thumb {
    max-width: 240px;
  }
  .manage-actions {
    flex-direction: row;
  }
}

#transition-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1000;
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .gallery img { transition: none; }
  .gallery a:hover img { transform: none; }
}
