/* Conteúdo escopado das janelas com Container Queries, Grid e Flexbox adaptativos */

.app-loading,
.app-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 20px;
  color: rgba(255, 255, 255, 0.85);
  font-family: 'Open Sans', Arial, sans-serif;
  text-align: center;
}

/* Seleção de texto permitida dentro do conteúdo das janelas */
.window .content,
.window .content * {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
}

.window .content {
  contain: layout style paint;
}

.lazy-media {
  opacity: 0;
  transition: opacity 0.22s ease;
}

.lazy-media.is-loaded {
  opacity: 1;
}

/* ===========================
   APP: SOBRE (about)
   =========================== */
.app-about {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: clamp(8px, 2cqi, 28px) clamp(4px, 2cqi, 24px) clamp(18px, 3cqi, 32px);
  min-height: 100%;
  box-sizing: border-box;
}

.app-about .profile-card {
  font-family: 'Open Sans', Arial, sans-serif;
  position: relative;
  margin: 0 auto;
  max-width: 680px;
  width: 100%;
  min-width: 0;
  color: #000000;
  text-align: center;
  line-height: 1.58;
  font-size: clamp(0.95rem, 1.5cqi, 1.03rem);
  box-shadow: none !important;
}

.app-about .profile-card *,
.app-projects .profile-card * {
  box-sizing: border-box;
}

.app-about .profile-card .profile-image {
  display: inline-block;
  width: clamp(130px, 42cqi, 240px);
  z-index: 1;
  position: relative;
  padding: 6px;
  border-radius: 50%;
  text-align: center;
}

.app-about .profile-card .profile-image img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  vertical-align: top;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.app-about ::selection {
  background: #3be97e75;
}

.app-about .profile-card figcaption {
  width: 100%;
  background-color: rgba(46, 46, 50, 0.68);
  text-shadow: #000000 1px 1px 5px;
  color: #ffffff;
  padding: calc(clamp(130px, 42cqi, 240px) * 0.52 + 16px) clamp(16px, 3.5cqi, 30px) clamp(18px, 3.5cqi, 28px);
  margin-top: calc(clamp(130px, 42cqi, 240px) * -0.45);
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2.2cqi, 22px);
  border-radius: 0.5em;
  text-align: left;
}

.app-about .about-bio-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 65ch;
  min-width: 0;
  overflow-wrap: break-word;
}

.app-about .about-meta-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.app-about .about-meta-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.app-about .about-icon-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.app-about .profile-card h3,
.app-about .profile-card h4,
.app-about .profile-card p {
  margin: 0;
}

.app-about .profile-card h3 {
  font-weight: 600;
  font-size: clamp(1.18em, 2.4cqi, 1.45em);
  font-family: 'Playfair Display', Arial, sans-serif;
  line-height: 1.25;
}

.app-about .profile-card h4,
.app-about .about-subheading {
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.35;
  margin-top: 6px;
}

.app-about .profile-card p {
  font-size: 1em;
  opacity: 0.92;
}

.app-about .profile-card i,
.app-projects .profile-card i {
  padding: 6px 4px;
  display: inline-block;
  font-size: clamp(1.55rem, 2.8cqi, 1.95rem);
  font-weight: normal;
  opacity: 0.82;
}

.app-about .profile-card i:hover,
.app-projects .profile-card i:hover {
  opacity: 1;
  transition: opacity 0.25s ease;
}

.app-about .profile-card .icon,
.app-projects .profile-card .icon {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  width: auto;
  height: auto;
  min-width: 44px;
  min-height: 44px;
  padding: 4px;
  margin: 0;
  text-decoration: none;
  color: #fff;
  font-size: 1.15em;
  background: none;
  backdrop-filter: none;
}

.app-about .profile-card .icon:hover,
.app-projects .profile-card .icon:hover {
  background: none;
  backdrop-filter: none;
}

@container win-body (max-width: 520px) {
  .app-about {
    padding: 6px 2px 18px;
  }

  .app-about .profile-card .profile-image {
    width: clamp(114px, 34cqi, 165px);
  }

  .app-about .profile-card figcaption {
    padding: calc(clamp(114px, 34cqi, 165px) * 0.52 + 14px) 16px 20px;
    margin-top: calc(clamp(114px, 34cqi, 165px) * -0.45);
    gap: 16px;
  }

  .app-about .about-meta-section {
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
  }
}

@container win-body (min-width: 740px) {
  .app-about .profile-card {
    max-width: min(1060px, 96%);
    display: grid;
    grid-template-columns: minmax(190px, 260px) minmax(0, 1fr);
    gap: clamp(20px, 3cqi, 38px);
    align-items: start;
    background-color: rgba(46, 46, 50, 0.68);
    border-radius: 0.65em;
    padding: clamp(22px, 3cqi, 36px);
    margin: auto;
  }

  .app-about .profile-card .profile-image {
    width: 100%;
    padding: 0;
    margin: 0;
    justify-self: center;
  }

  .app-about .profile-card figcaption {
    background-color: transparent;
    margin-top: 0;
    padding: 0;
    border-radius: 0;
    gap: 18px;
  }

  .app-about .profile-card h4,
  .app-about .about-subheading {
    letter-spacing: 0.08em;
  }
}

@container win-body (min-width: 1060px) {
  .app-about .about-meta-section {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr);
    gap: 24px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
  }
}

/* Tooltips compartilhados entre Sobre e Projetos */
.app-about .tooltip,
.app-projects .tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.app-about .tooltip-text,
.app-projects .tooltip-text {
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translate(-50%, 4px);
  background: #111;
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  z-index: 10;
}

.app-about .tooltip:hover .tooltip-text,
.app-about .tooltip:focus-within .tooltip-text,
.app-projects .tooltip:hover .tooltip-text,
.app-projects .tooltip:focus-within .tooltip-text {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* ===========================
   APP: PROJETOS (projects)
   =========================== */
.app-projects {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: clamp(10px, 2cqi, 26px) clamp(8px, 2cqi, 24px) clamp(20px, 3cqi, 32px);
  background-color: rgba(34, 34, 38, 0.62);
  border-radius: 6px;
  min-height: 100%;
  box-sizing: border-box;
}

.app-projects .projects-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(18px, 2.6cqi, 28px);
  width: min(1320px, 100%);
  margin: 0 auto;
}

.app-projects ::selection {
  background: #8585859a;
}

.app-projects .profile-card {
  font-family: 'Open Sans', Arial, sans-serif;
  position: relative;
  margin: 0 auto;
  max-width: 680px;
  width: 100%;
  min-width: 0;
  color: #000000;
  text-align: left;
  line-height: 1.58;
  font-size: clamp(0.95rem, 1.45cqi, 1.02rem);
  box-shadow: none !important;
  display: flex;
}

.app-projects .profile-card figcaption {
  width: 100%;
  min-width: 0;
  background-color: #3a3a3a81;
  text-shadow: #000000 1px 1px 5px;
  color: #ffffff;
  padding: clamp(18px, 2.8cqi, 26px) clamp(16px, 2.6cqi, 26px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  border-radius: 0.5em;
}

.app-projects .project-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 65ch;
  min-width: 0;
  overflow-wrap: break-word;
}

.app-projects .project-description-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  transition: transform 0.22s ease, filter 0.22s ease;
}

.app-projects .project-image-trigger,
.app-projects .project-image-link.tooltip {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  margin: 2px 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.app-projects .project-image-trigger {
  overflow: hidden;
  cursor: zoom-in;
}

.app-projects .project-image-link.tooltip .project-description-image {
  border-radius: 6px;
}

.app-projects .project-image-trigger:hover,
.app-projects .project-image-link.tooltip:hover,
.app-projects .project-image-trigger:focus-visible,
.app-projects .project-image-link.tooltip:focus-visible {
  border-color: rgba(255, 255, 255, 0.65);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  outline: none;
}

.app-projects .project-image-trigger:hover .project-description-image,
.app-projects .project-image-link.tooltip:hover .project-description-image,
.app-projects .project-image-trigger:focus-visible .project-description-image,
.app-projects .project-image-link.tooltip:focus-visible .project-description-image {
  transform: scale(1.015);
  filter: brightness(1.04);
}

.app-projects .project-image-expand-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.68);
  color: #ffffff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.app-projects .project-image-trigger:hover .project-image-expand-badge,
.app-projects .project-image-trigger:focus-visible .project-image-expand-badge {
  opacity: 1;
}

.app-projects .project-image-link.tooltip .tooltip-text {
  bottom: calc(100% + 8px);
}

@media (hover: none) {
  .app-projects .project-image-expand-badge {
    opacity: 0.92;
  }

  .app-projects .project-image-link.tooltip .tooltip-text {
    bottom: 8px;
    top: auto;
    opacity: 0.94;
    visibility: visible;
    transform: translate(-50%, 0);
    background: rgba(17, 17, 17, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.22);
    padding: 5px 10px;
  }
}

/* Lightbox em tela cheia para visualização da imagem do projeto (Z.A.T.O.) */
.project-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(10, 10, 14, 0.86);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 3vw, 36px);
  box-sizing: border-box;
}

.project-lightbox[hidden] {
  display: none;
}

.project-lightbox-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  max-width: min(94vw, 1180px);
  max-height: 100%;
}

.project-lightbox-img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100dvh - 150px);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.72);
}

.project-lightbox-repo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  font-family: 'Open Sans', Arial, sans-serif;
  font-size: clamp(0.9rem, 1.4vw, 1rem);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.project-lightbox-repo-link:hover,
.project-lightbox-repo-link:focus-visible {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateY(-1px);
  outline: none;
}

.project-lightbox-close {
  position: absolute;
  top: clamp(12px, 2vw, 22px);
  right: clamp(12px, 2vw, 22px);
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.project-lightbox-close:hover,
.project-lightbox-close:focus-visible {
  background: rgba(255, 17, 36, 0.65);
  border-color: rgba(255, 255, 255, 0.55);
  outline: none;
}

.app-projects .project-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 20px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  min-width: 0;
}

.app-projects .project-tech-block,
.app-projects .project-link-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.app-projects .project-tech-icons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.app-projects .profile-card h2 {
  margin: 0 0 2px;
  font-size: clamp(1.18rem, 2.2cqi, 1.45rem);
  line-height: 1.3;
  letter-spacing: normal;
  text-wrap: balance;
}

.app-projects .profile-card h3,
.app-projects .profile-card h4,
.app-projects .profile-card p {
  margin: 0;
}

.app-projects .profile-card h3 {
  font-weight: 600;
  font-size: 1.05em;
  line-height: 1.3;
  letter-spacing: 0.02em;
  font-family: 'Playfair Display', Arial, sans-serif;
}

.app-projects .profile-card h4 {
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.35;
  font-size: 0.92em;
}

.app-projects .profile-card p {
  font-size: 1em;
  line-height: 1.58;
  opacity: 0.94;
}

.app-projects .tech-svg-icon {
  display: block;
  width: clamp(24px, 2.4cqi, 32px);
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  flex-shrink: 0;
}

.app-projects .blog-avatar-icon {
  display: block;
  width: clamp(30px, 2.6cqi, 36px);
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
  flex-shrink: 0;
}

@container win-body (max-width: 520px) {
  .app-projects {
    padding: 6px 2px 18px;
    background-color: transparent;
  }

  .app-projects .projects-grid {
    gap: 20px;
  }

  .app-projects .profile-card figcaption {
    padding: 18px 16px;
    gap: 16px;
  }

  .app-projects .project-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .project-lightbox {
    padding: 14px;
  }

  .project-lightbox-close {
    width: 44px;
    height: 44px;
  }

  .project-lightbox-repo-link {
    min-height: 44px;
    width: 100%;
    max-width: 320px;
    box-sizing: border-box;
  }
}

@container win-body (min-width: 820px) {
  .app-projects .profile-card h4 {
    letter-spacing: 1px;
  }

  .app-projects .projects-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .app-projects .profile-card {
    max-width: none;
    margin: 0;
  }

  .app-projects .projects-grid > .profile-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

@container win-body (min-width: 1240px) {
  .app-projects .projects-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .app-projects .projects-grid > .profile-card:last-child:nth-child(odd) {
    grid-column: auto;
  }

  .app-projects .projects-grid > .profile-card:last-child:nth-child(3n - 1) {
    grid-column: span 2;
  }
}

/* ===========================
   APP: CONTATO (contact)
   =========================== */
.app-contact {
  font-family: 'Open Sans', Helvetica, Arial, sans-serif;
  font-weight: 300;
  font-size: clamp(0.95rem, 1.5cqi, 1.05rem);
  line-height: 1.5;
  color: #777;
  background-color: rgba(34, 34, 38, 0.44);
  min-height: 100%;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
}

.app-contact * {
  box-sizing: border-box;
}

.app-contact .container {
  text-shadow: #000000 1px 1px 5px;
  color: #ffffff;
  margin: auto;
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2cqi, 24px);
}

.app-contact #contact {
  background: rgba(54, 114, 92, 0.72);
  padding: clamp(16px, 3cqi, 32px);
  margin: 8px 0;
  width: min(540px, 98%);
  border-radius: 6px;
}

.app-contact .contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(12px, 2.2cqi, 28px);
}

.app-contact .contact-intro {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-contact #contact input[type="text"],
.app-contact #contact input[type="email"],
.app-contact #contact textarea,
.app-contact #contact button[type="submit"] {
  font: 400 14px/19px 'Open Sans', Helvetica, Arial, sans-serif;
}

.app-contact #contact h3 {
  display: block;
  font-size: clamp(1.35rem, 2.6cqi, 1.85rem);
  line-height: 1.2;
  font-weight: 400;
  margin: 0;
}

.app-contact #contact h4 {
  color: #e4e4e4dd;
  margin: 0;
  display: block;
  font-size: clamp(0.85rem, 1.4cqi, 0.96rem);
  font-weight: 400;
  max-width: 45ch;
}

.app-contact fieldset {
  border: none;
  margin: 0 0 10px;
  min-width: 100%;
  padding: 0;
  width: 100%;
}

.app-contact fieldset:last-child {
  margin-bottom: 0;
}

.app-contact #contact input[type="text"],
.app-contact #contact input[type="email"],
.app-contact #contact textarea {
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #222;
  margin: 0;
  padding: 10px 12px;
}

.app-contact #contact input:hover,
.app-contact #contact textarea:hover {
  transition: border-color 0.3s ease-in-out;
  border: 1px solid #aaa;
}

.app-contact #contact textarea {
  height: clamp(90px, 22cqh, 190px);
  max-width: 100%;
  resize: none;
}

.app-contact #contact input:focus,
.app-contact #contact textarea:focus {
  outline: 0;
  border: 1px solid #999;
}

.app-contact #contact button[type="submit"] {
  cursor: pointer;
  width: 100%;
  min-height: 44px;
  border: none;
  border-radius: 4px;
  background: rgb(119, 235, 187);
  color: #2c2c2c;
  font-weight: 700;
  margin: 0;
  padding: 11px 14px;
  font-size: 15px;
}

.app-contact #contact button[type="submit"]:hover:not(:disabled) {
  background: rgb(93, 185, 147);
  transition: background-color 0.3s ease-in-out;
}

.app-contact #contact button[type="submit"]:disabled {
  opacity: 0.7;
  cursor: wait;
}

.app-contact .contact-error {
  color: #ffd4d4;
  font-size: 13px;
  margin: 0 0 10px;
}

.app-contact .contact-sent {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 260px;
  text-align: center;
  background-color: #383838b9;
  color: #ffffff;
  padding: clamp(18px, 3cqi, 36px);
  border-radius: 6px;
  gap: 16px;
}

.app-contact .contact-sent-icon {
  font-size: clamp(3.5rem, 9cqi, 5.5rem);
  color: #ffffff;
}

.app-contact .contact-reset-btn {
  margin-top: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: none;
  border-radius: 4px;
  background: rgb(119, 235, 187);
  color: #2c2c2c;
  font-weight: 700;
  cursor: pointer;
}

.app-contact .contact-reset-btn:hover {
  background: rgb(93, 185, 147);
}

@container win-body (max-width: 560px) {
  .app-contact {
    background-color: transparent;
  }

  .app-contact .container {
    padding: 6px 2px 18px;
  }

  .app-contact #contact {
    width: 100%;
    margin: 0;
    padding: 18px 16px;
  }

  .app-contact .contact-grid {
    gap: 16px;
  }

  .app-contact #contact input[type="text"],
  .app-contact #contact input[type="email"],
  .app-contact #contact textarea {
    font-size: 16px;
    padding: 12px;
  }

  .app-contact #contact textarea {
    height: clamp(110px, 24cqh, 180px);
  }
}

@container win-body (min-width: 740px) {
  .app-contact #contact {
    width: min(880px, 94%);
  }

  .app-contact .contact-grid {
    grid-template-columns: minmax(210px, 0.8fr) minmax(300px, 1.2fr);
    gap: clamp(20px, 3cqi, 38px);
    align-items: start;
  }

  .app-contact .contact-intro {
    padding-top: 6px;
  }
}

/* ===========================
   APP: GALERIA (gallery)
   =========================== */
.app-gallery {
  background-color: rgba(34, 34, 38, 0.62);
  border-radius: 6px;
  min-height: 100%;
  padding: clamp(12px, 2.2cqi, 28px);
  box-sizing: border-box;
}

.app-gallery .personalizacao {
  font-family: 'Open Sans', Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(14px, 2.2cqi, 24px);
  width: 100%;
  color: white;
  text-shadow: #000000 1px 1px 5px;
}

.app-gallery .gallery-main-title {
  margin: 0;
  font-size: clamp(1.25rem, 2.4cqi, 1.65rem);
  text-align: center;
}

.app-gallery .gallery-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(22px, 3cqi, 36px);
  width: min(1480px, 100%);
  margin: 0 auto;
}

.app-gallery .gallery-themes-panel,
.app-gallery .gallery-music-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.app-gallery .section-title {
  margin: 0;
  font-weight: bold;
  font-size: clamp(1rem, 1.7cqi, 1.2rem);
  text-align: center;
}

.app-gallery #wallpaper-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(168px, 28cqi, 240px), 1fr));
  gap: clamp(14px, 2.2cqi, 24px);
  width: 100%;
  align-items: start;
}

.app-gallery .wallpaper-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  width: 100%;
  min-width: 0;
  gap: 8px;
  contain: layout style;
}

.app-gallery .wallpaper-thumb-box {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  margin: 0;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.app-gallery .wallpaper-option {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 2px solid transparent;
  border-radius: 8px;
  box-sizing: border-box;
  cursor: pointer;
  transition: border-color 0.2s, opacity 0.22s ease, transform 0.22s ease;
}

.app-gallery .wallpaper-option:hover {
  transform: scale(1.02);
}

.app-gallery .wallpaper-option.selected {
  border-color: #ffffff;
}

.app-gallery .wallpaper-zoom-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.68);
  color: #ffffff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s ease, background-color 0.15s ease;
}

.app-gallery .wallpaper-thumb-box:hover .wallpaper-zoom-btn,
.app-gallery .wallpaper-zoom-btn:focus-visible {
  opacity: 1;
}

.app-gallery .wallpaper-zoom-btn:hover {
  background: rgba(0, 0, 0, 0.9);
}

.app-gallery .wallpaper-title {
  color: #fff;
  font-size: clamp(0.92rem, 1.4cqi, 1rem);
  text-shadow: #000 1px 1px 4px;
  font-weight: bold;
  line-height: 1.3;
}

.app-gallery .wallpaper-desc {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.74);
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: left;
  font-size: clamp(0.76rem, 1.25cqi, 0.85rem);
  line-height: 1.38;
  padding: 10px 12px;
  pointer-events: none;
  border-radius: 8px;
  z-index: 2;
}

.app-gallery .wallpaper-thumb-box:hover .wallpaper-desc {
  opacity: 1;
}

@media (hover: none) {
  .app-gallery .wallpaper-zoom-btn {
    opacity: 0.94;
    width: 38px;
    height: 38px;
    font-size: 14px;
  }

  .app-gallery .wallpaper-desc {
    inset: auto 0 0 0;
    opacity: 1;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.86) 0%, rgba(0, 0, 0, 0.52) 65%, transparent 100%);
    color: rgba(255, 255, 255, 0.94);
    padding: 20px 10px 8px;
    justify-content: flex-start;
    align-items: flex-end;
    text-align: left;
    font-size: 0.78rem;
    line-height: 1.32;
    border-radius: 0 0 8px 8px;
  }
}

.app-gallery .gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.86);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: clamp(14px, 2.5vw, 24px);
  box-sizing: border-box;
}

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

.app-gallery .lightbox-img {
  max-width: min(94%, 1160px);
  max-height: calc(100% - 88px);
  width: auto;
  height: auto;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7);
}

.app-gallery .lightbox-caption {
  color: rgba(255, 255, 255, 0.92);
  font-family: 'Open Sans', Arial, sans-serif;
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: center;
  max-width: 65ch;
  flex-shrink: 0;
}

.app-gallery .lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-gallery .lightbox-close:hover {
  background: rgba(255, 17, 36, 0.55);
}

.app-gallery .music-section-heading {
  margin: 0;
}

.app-gallery .spotify-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: clamp(12px, 1.8cqi, 18px);
  width: 100%;
  justify-items: stretch;
}

.app-gallery .spotify-card {
  position: relative;
  width: 100%;
  max-width: none;
  min-width: 0;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(24, 24, 24, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  contain: layout style paint;
}

.app-gallery .spotify-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7);
}

.app-gallery .card-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  filter: blur(18px) brightness(1.05) saturate(2.6) contrast(1.12);
  transform: scale(1.2);
  z-index: 1;
  opacity: 0.3;
}

.app-gallery .card-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  padding: clamp(12px, 1.8cqi, 16px);
  gap: 14px;
}

.app-gallery .album-art {
  display: block;
  width: 56px;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  background: rgba(255, 255, 255, 0.08);
}

.app-gallery .song-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-grow: 1;
  min-width: 0;
  overflow: hidden;
}

.app-gallery .track-title {
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.app-gallery .track-artist {
  color: #b3b3b3;
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-gallery .play-button {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1db954;
  background: rgba(0, 0, 0, 0.4);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
  cursor: pointer;
}

.app-gallery .play-button:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.1);
}

.app-gallery .play-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

@container win-body (max-width: 460px) {
  .app-gallery {
    padding: 10px 8px 20px;
  }

  .app-gallery .gallery-layout {
    gap: 24px;
  }

  .app-gallery #wallpaper-options {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .app-gallery .spotify-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
}

@container win-body (min-width: 820px) {
  .app-gallery .gallery-layout {
    grid-template-columns: minmax(0, 1.55fr) minmax(290px, 0.95fr);
    align-items: start;
  }

  .app-gallery .gallery-themes-panel,
  .app-gallery .gallery-music-panel {
    align-items: stretch;
  }

  .app-gallery .section-title {
    text-align: left;
  }

  .app-gallery #wallpaper-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-gallery .spotify-list {
    grid-template-columns: minmax(0, 1fr);
    justify-items: stretch;
  }
}

@container win-body (min-width: 1120px) {
  .app-gallery .gallery-layout {
    grid-template-columns: minmax(0, 1.85fr) minmax(300px, 0.85fr);
  }

  .app-gallery #wallpaper-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
