:root {
  --paper: #F6F8F2;
  --ink: #293128;
  --accent: #53664B;
  --line: #CBD5C4;
  --gallery-sage: #EEF2E7;
  --gallery-forest: #35462F;
  --gallery-gold: #B89550;
  --gallery-sans: "Hiragino Sans", "Yu Gothic", sans-serif;
}

.gallery-page {
  background: var(--paper);
}

.gallery-header {
  position: sticky;
  z-index: 20;
  top: 0;
  width: 100%;
  margin-inline: 0;
  padding: 14px max(20px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--gallery-sage);
  box-shadow: 0 6px 20px rgb(35 51 38 / .08);
}

.gallery-brand {
  color: var(--gallery-forest);
  font-size: clamp(1.35rem, 5vw, 2rem);
  letter-spacing: .1em;
}

.gallery-header .text-link {
  min-height: 44px;
  margin: 0;
  align-items: center;
  color: var(--ink);
  border-bottom: 0;
  font: 600 13px/1.4 var(--gallery-sans);
  letter-spacing: .04em;
}

.gallery-main {
  width: min(calc(100% - 40px), 1180px);
}

.gallery-intro {
  padding-block: clamp(3.75rem, 12vw, 7rem) clamp(2.5rem, 8vw, 4.5rem);
}

.gallery-intro::before {
  display: block;
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
  background: var(--gallery-gold);
  content: "";
  -webkit-mask: url("sample-03-b/assets/paw.svg") center / contain no-repeat;
  mask: url("sample-03-b/assets/paw.svg") center / contain no-repeat;
}

.gallery-eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font: 600 11px/1.4 var(--gallery-sans);
  letter-spacing: .16em;
}

.gallery-intro h1 {
  max-width: 14em;
  margin-bottom: 16px;
  padding: 0;
  border-bottom: 0;
  font-size: clamp(2.25rem, calc(5vw + 1rem), 4.5rem);
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: .035em;
}

.gallery-intro > p:last-child {
  color: var(--accent);
  font-size: clamp(.95rem, 2vw, 1.1rem);
}

.gallery-grid {
  gap: clamp(10px, 2vw, 18px);
}

.gallery-grid a,
.gallery-grid img,
.gallery-media,
.gallery-media__poster {
  border-radius: 0 38px 0 38px;
}

.gallery-grid a,
.gallery-media {
  border-color: var(--line);
  background: var(--gallery-sage);
}

.gallery-media {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  color: inherit;
  font: inherit;
  overflow: hidden;
  cursor: pointer;
}

.gallery-grid__received img,
.gallery-media__poster {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.gallery-media__poster {
  height: auto;
  background: var(--gallery-forest);
}

.gallery-media__play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid rgb(246 248 242 / .8);
  border-radius: 50%;
  background: rgb(35 51 38 / .82);
  color: #fff;
  font: 700 18px/1 var(--gallery-sans);
  transform: translate(-50%, -50%);
}

.gallery-media:focus-visible {
  outline: 3px solid var(--gallery-gold);
  outline-offset: 4px;
}

html.gallery-lightbox-open,
html.gallery-lightbox-open body {
  overflow: hidden;
}

.gallery-lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgb(21 31 23 / .96);
  color: #f6f8f2;
  overflow: hidden;
}

.gallery-lightbox:not([open]) {
  display: none;
}

.gallery-lightbox::backdrop {
  background: rgb(21 31 23 / .96);
}

.gallery-lightbox__shell {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 100%;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 8px;
}

.gallery-lightbox__viewport {
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  touch-action: pan-y;
}

.gallery-lightbox__stage {
  display: grid;
  width: 100%;
  height: 100%;
  max-height: calc(100dvh - 176px);
  place-items: center;
}

.gallery-lightbox__media {
  display: block;
  width: 100%;
  max-width: calc(100vw - 24px);
  height: 100%;
  max-height: calc(100dvh - 176px);
  border-radius: 0 38px 0 38px;
  background: #172019;
  object-fit: contain;
}

.gallery-lightbox__toolbar {
  display: grid;
  width: min(100%, 360px);
  margin-inline: auto;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 10px;
}

.gallery-lightbox__control {
  display: grid;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  place-items: center;
  border: 1px solid rgb(246 248 242 / .72);
  border-radius: 50%;
  background: rgb(238 242 231 / .12);
  color: #f6f8f2;
  font: 700 22px/1 var(--gallery-sans);
  cursor: pointer;
}

.gallery-lightbox__control:focus-visible {
  outline: 3px solid var(--gallery-gold);
  outline-offset: 3px;
}

.gallery-lightbox__close {
  z-index: 2;
  justify-self: end;
  font-size: 30px;
}

.gallery-lightbox__position {
  margin: 0;
  color: #f6f8f2;
  font: 600 13px/1.4 var(--gallery-sans);
  letter-spacing: .12em;
  text-align: center;
}

.gallery-lightbox__error {
  margin: 0;
  color: #f6f8f2;
  font: 600 14px/1.6 var(--gallery-sans);
  text-align: center;
}

.gallery-lightbox__error[hidden] {
  display: none;
}

.gallery-synced {
  border-top-color: var(--line);
}

.gallery-synced h2 {
  font-weight: 400;
}

.gallery-footer {
  border-top-color: var(--line);
}

.gallery-footer .button {
  min-height: 50px;
  border-color: var(--gallery-forest);
  font: 600 14px/1.4 var(--gallery-sans);
  letter-spacing: .05em;
}

.gallery-footer .button-primary {
  border-color: #35462F;
  background: #35462F;
  color: #F6F8F2;
}

@media (hover: hover) {
  .gallery-media:hover,
  .gallery-lightbox__control:hover {
    border-color: var(--gallery-gold);
  }

  .gallery-footer .button-primary:hover {
    border-color: #233326;
    background: #233326;
    color: #F6F8F2;
  }
}

@media (min-width: 768px) {
  .gallery-lightbox__shell {
    padding: 24px max(72px, 7vw);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .gallery-lightbox__viewport,
  .gallery-lightbox__stage {
    width: 86vw;
    max-width: 1400px;
    height: 84vh;
    max-height: 84vh;
    justify-self: center;
  }

  .gallery-lightbox__media {
    max-width: 86vw;
    max-height: 84vh;
  }

  .gallery-lightbox__toolbar {
    display: contents;
  }

  .gallery-lightbox__previous,
  .gallery-lightbox__next {
    position: absolute;
    z-index: 2;
    top: 50%;
    transform: translateY(-50%);
  }

  .gallery-lightbox__previous {
    left: max(18px, 2.5vw);
  }

  .gallery-lightbox__next {
    right: max(18px, 2.5vw);
  }

  .gallery-lightbox__position {
    position: absolute;
    bottom: max(18px, env(safe-area-inset-bottom));
    left: 50%;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgb(21 31 23 / .72);
    transform: translateX(-50%);
  }

  .gallery-lightbox__error {
    position: absolute;
    bottom: 62px;
    left: 50%;
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-media__play,
  .gallery-lightbox__control {
    transition: none;
  }
}
