* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: #e9edf0;
  color: #17201a;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial,
    sans-serif;
}

body:has(.gallery-site) {
  background: #fff;
}

.qr-gate,
.qr-admin-page {
  width: min(100vw, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 16px 26px;
  background: #f8faf8;
}

.qr-gate {
  display: grid;
  place-items: center;
}

.qr-gate__panel,
.qr-admin-card {
  width: 100%;
  border: 1px solid #dde6df;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(28, 43, 32, 0.09);
}

.qr-gate__panel {
  padding: 26px 20px;
}

.qr-gate__label,
.qr-admin-card__label {
  margin: 0;
  color: #5b735f;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.qr-gate h1,
.qr-admin-card h1 {
  margin: 8px 0 0;
  color: #152016;
  font-size: 26px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.15;
}

.qr-gate__panel p:last-child,
.qr-admin-card__intro {
  margin: 12px 0 0;
  color: #5f6f64;
  font-size: 15px;
  line-height: 1.55;
}

.qr-admin-page {
  display: flex;
  align-items: center;
}

.qr-admin-card {
  padding: 22px 18px 18px;
}

.qr-admin-card__image {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
  padding: 16px;
  border: 1px solid #e4ece6;
  border-radius: 8px;
  background: #f5f8f5;
}

.qr-admin-card__image img {
  display: block;
  width: min(100%, 280px);
  aspect-ratio: 1;
  object-fit: contain;
}

.qr-admin-card__url {
  overflow-wrap: anywhere;
  margin: 14px 0 0;
  color: #607268;
  font-size: 12px;
  line-height: 1.45;
}

button,
input,
a {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.material-app,
.image-library-app {
  width: min(100vw, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 16px 26px;
  background: #f8faf8;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.app-header__label,
.section-heading p,
.featured-card__content p,
.modal-category {
  margin: 0;
  color: #5b735f;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.app-header h1,
.section-heading h2,
.modal-content h2 {
  margin: 4px 0 0;
  color: #152016;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.08;
}

.header-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  height: 32px;
  border: 1px solid #d9e3dc;
  border-radius: 999px;
  color: #315a3b;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.search-section {
  margin-top: 20px;
}

.search-box {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  border: 1px solid #dfe7e1;
  border-radius: 999px;
  background: #fff;
  color: #718075;
}

.icon {
  display: block;
  width: 20px;
  height: 20px;
}

.search-box input {
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: #17201a;
  font-size: 15px;
}

.search-box input::placeholder {
  color: #88958c;
}

.category-list {
  display: flex;
  gap: 8px;
  margin-top: 13px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.category-list::-webkit-scrollbar {
  display: none;
}

.category-chip {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 14px;
  border: 1px solid #dbe5dd;
  border-radius: 999px;
  background: #fff;
  color: #536458;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.category-chip[aria-pressed="true"] {
  border-color: #245b37;
  background: #245b37;
  color: #fff;
}

.featured-card {
  display: flex;
  align-items: flex-end;
  min-height: 228px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 8px;
  background-color: #dce5df;
  background-position: center;
  background-size: cover;
  box-shadow: 0 18px 40px rgba(28, 43, 32, 0.16);
}

.featured-card__content {
  width: 100%;
  padding: 62px 16px 16px;
  background: linear-gradient(180deg, rgba(10, 18, 12, 0) 0%, rgba(10, 18, 12, 0.72) 100%);
  color: #fff;
}

.featured-card__content p,
.featured-card__content span {
  color: rgba(255, 255, 255, 0.82);
}

.featured-card__content h2 {
  margin: 5px 0 3px;
  color: #fff;
  font-size: 28px;
  line-height: 1.08;
}

.featured-card__content span {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.featured-card__button {
  height: 36px;
  margin-top: 12px;
  padding: 0 15px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #214a2f;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
}

.materials-section {
  margin-top: 24px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h2 {
  font-size: 22px;
}

.section-heading span {
  flex: 0 0 auto;
  color: #657469;
  font-size: 13px;
  font-weight: 700;
}

.material-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.image-library-grid {
  display: grid;
  gap: 14px;
}

.image-store-card {
  overflow: hidden;
  border: 1px solid #e3e9e4;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(28, 43, 32, 0.08);
}

.image-store-card__preview {
  display: block;
  width: 100%;
  aspect-ratio: 1.6;
  object-fit: cover;
}

.image-store-card__body {
  display: grid;
  gap: 12px;
  padding: 13px;
}

.image-store-card__category {
  color: #386244;
  font-size: 12px;
  font-weight: 800;
}

.image-store-card h2 {
  margin: 4px 0 0;
  color: #17201a;
  font-size: 20px;
  font-weight: 850;
  line-height: 1.15;
}

.image-store-card p {
  margin: 7px 0 0;
  color: #66766b;
  font-size: 13px;
  line-height: 1.45;
}

.image-store-card__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
}

.image-store-card__meta div {
  min-width: 0;
  padding: 9px;
  border-radius: 8px;
  background: #f1f5f2;
}

.image-store-card__meta dt {
  color: #6f7f73;
  font-size: 11px;
  font-weight: 800;
}

.image-store-card__meta dd {
  overflow-wrap: anywhere;
  margin: 4px 0 0;
  color: #17201a;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.image-store-card__qr {
  display: grid;
  grid-template-columns: 112px 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid #e1e9e4;
  border-radius: 8px;
  background: #fbfcfb;
}

.image-store-card__qr img {
  display: block;
  width: 112px;
  aspect-ratio: 1;
  object-fit: contain;
}

.image-store-card__qr a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #245b37;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}

.material-card {
  display: block;
  overflow: hidden;
  padding: 0;
  border: 1px solid #e3e9e4;
  border-radius: 8px;
  background: #fff;
  color: inherit;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 10px 22px rgba(28, 43, 32, 0.06);
}

.material-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 0.78;
  object-fit: cover;
}

.material-card__body {
  display: block;
  padding: 10px;
}

.material-card__title {
  display: block;
  color: #18231b;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
}

.material-card__meta {
  display: block;
  margin-top: 4px;
  color: #6b786f;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
}

.empty-state {
  margin: 20px 0 10px;
  padding: 18px;
  border: 1px dashed #cbd8ce;
  border-radius: 8px;
  color: #6b786f;
  text-align: center;
}

.material-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 14px;
  background: rgba(9, 13, 10, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.material-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-sheet {
  position: relative;
  width: min(100%, 430px);
  max-height: 88vh;
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(8, 13, 10, 0.3);
  transform: translateY(16px);
  transition: transform 0.18s ease;
}

.material-modal.is-open .modal-sheet {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
}

.modal-close span {
  position: absolute;
  top: 16px;
  left: 9px;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: #1d261f;
}

.modal-close span:first-child {
  transform: rotate(45deg);
}

.modal-close span:last-child {
  transform: rotate(-45deg);
}

.modal-image {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.modal-content {
  padding: 16px;
}

.modal-content h2 {
  font-size: 24px;
}

.modal-content p {
  margin: 8px 0 0;
  color: #617167;
  font-size: 14px;
  line-height: 1.55;
}

.modal-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 0;
}

.modal-meta div {
  padding: 10px;
  border-radius: 8px;
  background: #f1f5f2;
}

.modal-meta dt {
  color: #6f7f73;
  font-size: 12px;
  font-weight: 700;
}

.modal-meta dd {
  margin: 3px 0 0;
  color: #17201a;
  font-size: 13px;
  font-weight: 800;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #edf4ef;
  color: #356143;
  font-size: 12px;
  font-weight: 750;
}

.download-button {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  margin-top: 16px;
  border-radius: 8px;
  background: #245b37;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
}

@media (min-width: 560px) {
  .material-app {
    margin-top: 24px;
    margin-bottom: 24px;
    border-radius: 18px;
  }
}

@media (min-width: 760px) {
  .image-library-app {
    width: min(100% - 64px, 1180px);
    min-height: 100vh;
    padding: 40px 0 56px;
    background: transparent;
  }

  .image-library-app .app-header {
    align-items: center;
    padding: 6px 0 2px;
  }

  .image-library-app .app-header h1 {
    margin: 0;
    font-size: 42px;
    line-height: 1.05;
  }

  .image-library-app .search-section {
    display: grid;
    grid-template-columns: minmax(280px, 420px) 1fr;
    align-items: center;
    gap: 18px;
    margin-top: 26px;
    padding: 18px;
    border: 1px solid #dfe7e1;
    border-radius: 8px;
    background: #f8faf8;
    box-shadow: 0 16px 36px rgba(28, 43, 32, 0.08);
  }

  .image-library-app .search-box {
    height: 48px;
    border-radius: 8px;
  }

  .image-library-app .category-list {
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-top: 0;
    overflow: visible;
    padding-bottom: 0;
  }

  .image-library-app .category-chip {
    height: 36px;
    border-radius: 8px;
  }

  .image-library-app .materials-section {
    margin-top: 28px;
    padding: 24px;
    border: 1px solid #dfe7e1;
    border-radius: 8px;
    background: #f8faf8;
    box-shadow: 0 18px 40px rgba(28, 43, 32, 0.07);
  }

  .image-library-app .section-heading {
    align-items: center;
    margin-bottom: 20px;
  }

  .image-library-app .section-heading h2 {
    font-size: 28px;
  }

  .image-library-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
  }

  .image-library-app .image-store-card {
    transition:
      border-color 0.18s ease,
      box-shadow 0.18s ease,
      transform 0.18s ease;
  }

  .image-library-app .image-store-card:hover {
    border-color: #c8d7cd;
    box-shadow: 0 18px 38px rgba(28, 43, 32, 0.14);
    transform: translateY(-2px);
  }

  .image-library-app .image-store-card__preview {
    aspect-ratio: 16 / 10;
  }

  .image-library-app .image-store-card__body {
    min-height: 136px;
    padding: 16px;
  }

  .image-library-app .image-store-card h2 {
    font-size: 21px;
  }

  .image-library-app .image-store-card p {
    font-size: 14px;
  }
}

@media (min-width: 1100px) {
  .image-library-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.gallery-site.image-library-app {
  width: min(100%, 430px);
  padding: 16px 16px 34px;
  background: #fff;
}

.site-nav {
  display: grid;
  gap: 14px;
}

.site-brand {
  color: #141a16;
  font-size: 22px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1;
  text-decoration: none;
}

.site-nav__categories {
  margin-top: 0;
}

.gallery-site .category-chip {
  border-color: rgba(20, 26, 22, 0.12);
  background: rgba(255, 255, 255, 0.88);
  color: #26352b;
  font-size: 13px;
}

.gallery-site .category-chip[aria-pressed="true"] {
  border-color: #1f6b45;
  background: #1f6b45;
  color: #fff;
}

.gallery-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 440px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 8px;
  background: #20382c;
  color: #fff;
}

.gallery-hero__media {
  position: absolute;
  inset: 0;
  margin: 0;
}

.gallery-hero__media::after {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 13, 10, 0.78) 0%, rgba(8, 13, 10, 0.2) 62%, rgba(8, 13, 10, 0) 100%),
    linear-gradient(180deg, rgba(8, 13, 10, 0) 42%, rgba(8, 13, 10, 0.66) 100%);
  content: "";
}

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

.gallery-hero__media figcaption {
  position: absolute;
  right: 18px;
  bottom: 16px;
  z-index: 1;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 700;
}

.gallery-hero__content {
  position: relative;
  z-index: 1;
  width: min(100%, 590px);
  padding: 28px 18px 58px;
}

.gallery-hero h1 {
  margin: 0;
  color: #fff;
  font-size: 42px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.04;
}

.gallery-hero p {
  max-width: 500px;
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 15px;
  line-height: 1.65;
}

.gallery-site .gallery-hero .search-box {
  width: min(100%, 390px);
  height: 46px;
  margin-top: 24px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #36513e;
  box-shadow: 0 18px 38px rgba(6, 12, 8, 0.22);
}

.gallery-site .materials-section {
  margin-top: 34px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.gallery-site .section-heading {
  margin-bottom: 18px;
}

.gallery-site .section-heading p {
  color: #1f6b45;
  font-size: 12px;
  font-weight: 800;
}

.gallery-site .section-heading h2 {
  margin-top: 5px;
  font-size: 26px;
}

.gallery-site .image-library-grid {
  gap: 22px;
}

.gallery-site .image-store-card {
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.gallery-site .image-store-card__preview {
  border-radius: 8px;
  aspect-ratio: 4 / 3;
  box-shadow: 0 16px 34px rgba(20, 29, 22, 0.12);
  transition:
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.gallery-site .image-store-card__body {
  gap: 0;
  min-height: 0;
  padding: 12px 2px 0;
}

.gallery-site .image-store-card__category {
  color: #1f6b45;
  font-size: 12px;
  letter-spacing: 0;
}

.gallery-site .image-store-card h2 {
  margin-top: 5px;
  color: #141a16;
  font-size: 21px;
  line-height: 1.18;
}

.gallery-site .image-store-card p {
  margin-top: 8px;
  color: #5f6d63;
  font-size: 14px;
  line-height: 1.55;
}

@media (hover: hover) {
  .gallery-site .image-store-card:hover .image-store-card__preview {
    box-shadow: 0 24px 44px rgba(20, 29, 22, 0.18);
    transform: translateY(-3px);
  }
}

@media (min-width: 760px) {
  .image-library-app {
    width: min(100% - 40px, 1180px);
    padding: 22px 0 70px;
    background: #fff;
  }

  .gallery-site.image-library-app {
    width: min(100% - 40px, 1180px);
  }

  .site-nav {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 28px;
  }

  .site-brand {
    font-size: 24px;
  }

  .site-nav__categories {
    justify-content: flex-end;
    overflow: visible;
    padding-bottom: 0;
  }

  .gallery-hero {
    min-height: 460px;
    margin-top: 22px;
  }

  .gallery-hero__content {
    padding: 56px 58px 72px;
  }

  .gallery-hero h1 {
    font-size: 64px;
  }

  .gallery-hero p {
    font-size: 17px;
  }

  .gallery-site .materials-section {
    margin-top: 48px;
  }

  .image-library-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 30px 24px;
  }

  .gallery-site .image-store-card:nth-child(1),
  .gallery-site .image-store-card:nth-child(6) {
    grid-column: span 2;
  }

  .gallery-site .image-store-card:nth-child(1) .image-store-card__preview,
  .gallery-site .image-store-card:nth-child(6) .image-store-card__preview {
    aspect-ratio: 16 / 9;
  }
}

@media (min-width: 1180px) {
  .gallery-site .image-library-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 759px) {
  .gallery-hero {
    min-height: 390px;
  }

  .gallery-site .image-library-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
