/* Photos is an isolated local-library surface. It consumes the desktop's file
   events but owns no second file store and sends nothing to a server. */
.photos-layer {
  position: fixed;
  z-index: 258;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 38px;
  background: rgba(10, 12, 17, 0.62);
  color: #1c1c1e;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  backdrop-filter: blur(18px);
}

.photos-layer[hidden],
.photos-viewer[hidden],
.photos-empty[hidden],
.photos-toast[hidden],
.photos-grid[hidden] { display: none; }

.photos-window {
  position: relative;
  width: min(1080px, calc(100vw - 76px));
  height: min(760px, calc(100dvh - 76px));
  min-height: 570px;
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.44);
  border-radius: 14px;
  background: #f7f7f8;
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.58);
}

.photos-titlebar {
  position: relative;
  display: grid;
  grid-template-columns: 120px 1fr 120px;
  align-items: center;
  padding: 0 15px;
  border-bottom: 1px solid #c9c9cd;
  background: #ececef;
  user-select: none;
}

.photos-titlebar strong {
  justify-self: center;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.photos-local {
  justify-self: end;
  color: #77777d;
  font-size: 10px;
  white-space: nowrap;
}

.photos-close {
  width: 13px;
  height: 13px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #ff5f57;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.photos-shell {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 214px minmax(0, 1fr);
}

.photos-sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 12px 16px;
  border-right: 1px solid #d4d4d7;
  background: #ececef;
}

.photos-sidebar h2 {
  margin: 0 10px 4px;
  font-size: 18px;
  letter-spacing: -0.025em;
}

.photos-collection {
  width: 100%;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #242426;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: default;
}

.photos-collection.is-active {
  background: #1769e0;
  color: #fff;
}

.photos-collection-icon {
  font-size: 18px;
  line-height: 1;
  text-align: center;
}

.photos-collection small {
  min-width: 18px;
  color: inherit;
  font-size: 11px;
  text-align: right;
  opacity: 0.84;
}

.photos-privacy-card {
  margin-top: auto;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 2px 8px;
  padding: 12px;
  border: 1px solid #d2d2d6;
  border-radius: 9px;
  background: #f7f7f8;
}

.photos-privacy-card > span {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: #e4f0ff;
  color: #1769e0;
  font-size: 15px;
}

.photos-privacy-card strong { font-size: 11px; }
.photos-privacy-card p {
  margin: 0;
  color: #74747a;
  font-size: 9px;
  line-height: 1.35;
}

.photos-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: #f7f7f8;
}

.photos-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 28px 16px;
  background: #f7f7f8;
}

.photos-toolbar h2 {
  margin: 0;
  font-size: 27px;
  letter-spacing: -0.035em;
}

.photos-toolbar p {
  margin: 3px 0 0;
  color: #77777d;
  font-size: 12px;
}

.photos-actions,
.photos-empty-actions {
  display: flex;
  gap: 8px;
}

.photos-actions button,
.photos-empty button,
.photos-viewer-bar button {
  min-height: 30px;
  padding: 6px 12px;
  border: 1px solid #c8c8cc;
  border-radius: 7px;
  background: #fff;
  color: #252527;
  font: inherit;
  font-size: 12px;
  font-weight: 580;
  cursor: pointer;
}

.photos-actions .is-primary,
.photos-empty .is-primary {
  border-color: #1769e0;
  background: #1769e0;
  color: #fff;
}

.photos-actions button:hover,
.photos-empty button:hover { border-color: #1769e0; }

.photos-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
  grid-auto-rows: 170px;
  gap: 5px;
  align-content: start;
  padding: 0 28px 28px;
  overflow: auto;
}

.photos-card {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: #dadade;
  cursor: zoom-in;
}

.photos-grid.is-mosaic .photos-card:nth-child(7n + 1),
.photos-grid.is-mosaic .photos-card:nth-child(7n + 4) { grid-row: span 2; }

.photos-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 180ms ease;
}

.photos-card:hover img,
.photos-card:focus-visible img { transform: scale(1.025); }

.photos-card > span {
  position: absolute;
  inset: auto 0 0;
  display: grid;
  gap: 1px;
  padding: 22px 9px 8px;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  text-align: left;
  opacity: 0;
  transition: opacity 150ms ease;
}

.photos-card:hover > span,
.photos-card:focus-visible > span { opacity: 1; }
.photos-card b { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.photos-card small { font-size: 8px; opacity: 0.82; }

.photos-empty {
  min-height: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 36px;
  text-align: center;
}

.photos-empty-mark {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.12);
}

.photos-empty-mark::before {
  content: "✿";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #ff375f;
  font-size: 68px;
  line-height: 1;
}

.photos-empty-mark::after {
  content: "";
  position: absolute;
  left: 42px;
  top: 42px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffd60a;
}

.photos-empty h3 { margin: 10px 0 0; font-size: 21px; }
.photos-empty p { max-width: 390px; margin: 0 0 8px; color: #77777d; font-size: 13px; line-height: 1.45; }

.photos-viewer {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr) 78px;
  background: #101012;
  color: #f5f5f7;
}

.photos-viewer-bar {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(0, 2fr) minmax(260px, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid #2a2a2e;
  background: #1c1c1f;
}

.photos-viewer-bar .photos-viewer-close {
  justify-self: start;
  border-color: #3a3a3e;
  background: #2c2c30;
  color: #f5f5f7;
}

.photos-viewer-title {
  min-width: 0;
  display: grid;
  justify-items: center;
}

.photos-viewer-title strong {
  max-width: 100%;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photos-viewer-title small { margin-top: 2px; color: #9b9ba1; font-size: 9px; }

.photos-viewer-actions {
  justify-self: end;
  display: flex;
  gap: 6px;
}

.photos-viewer-actions button {
  border-color: #3a3a3e;
  background: #2c2c30;
  color: #f5f5f7;
}

.photos-viewer-actions .photos-trash { color: #ff6961; }

.photos-viewer-stage {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 10px;
  padding: 14px;
  overflow: hidden;
  background: #09090a;
}

.photos-viewer-image {
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  user-select: none;
  touch-action: pan-y;
}

.photos-previous,
.photos-next {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #2a2a2e;
  color: #fff;
  font: inherit;
  font-size: 31px;
  line-height: 1;
  cursor: pointer;
}

.photos-previous:disabled,
.photos-next:disabled { opacity: 0.2; cursor: default; }

.photos-filmstrip {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px 12px;
  overflow-x: auto;
  border-top: 1px solid #252529;
  background: #171719;
}

.photos-filmstrip button {
  flex: 0 0 62px;
  width: 62px;
  height: 50px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 5px;
  background: #2a2a2e;
  opacity: 0.55;
  cursor: pointer;
}

.photos-filmstrip button[aria-selected="true"] { border-color: #fff; opacity: 1; }
.photos-filmstrip img { width: 100%; height: 100%; display: block; object-fit: cover; }

.photos-toast {
  position: absolute;
  z-index: 9;
  left: 50%;
  bottom: 22px;
  max-width: calc(100% - 40px);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(28, 28, 31, 0.92);
  color: #fff;
  font-size: 11px;
  transform: translateX(-50%);
  pointer-events: none;
}

/* Eight solid petals keep the icon recognizable without shipping another image. */
.photos-icon {
  position: relative;
  width: 42px;
  height: 42px;
  display: block;
  overflow: hidden;
  border-radius: 11px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12), 0 2px 5px rgba(0, 0, 0, 0.34);
}

.photos-icon i {
  --color: #ff375f;
  position: absolute;
  left: 16px;
  top: 5px;
  width: 10px;
  height: 16px;
  border-radius: 8px 8px 5px 5px;
  background: var(--color);
  transform: rotate(calc(var(--petal) * 45deg));
  transform-origin: 5px 16px;
}

.photos-icon i:nth-child(2) { --color: #ff9f0a; }
.photos-icon i:nth-child(3) { --color: #ffd60a; }
.photos-icon i:nth-child(4) { --color: #32d74b; }
.photos-icon i:nth-child(5) { --color: #64d2ff; }
.photos-icon i:nth-child(6) { --color: #0a84ff; }
.photos-icon i:nth-child(7) { --color: #5e5ce6; }
.photos-icon i:nth-child(8) { --color: #bf5af2; }

.photos-icon b {
  position: absolute;
  left: 17px;
  top: 17px;
  width: 8px;
  height: 8px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #f5c542;
}

.photos-launcher {
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.photos-phone-tile { background: #fff !important; }
.photos-phone-tile .photos-icon {
  width: 60px;
  height: 60px;
  border-radius: 0;
  box-shadow: none;
  transform: scale(1.3);
}

@media (max-width: 900px) {
  .photos-layer {
    padding: 0;
    place-items: stretch;
    background: #f7f7f8;
    backdrop-filter: none;
  }

  .photos-window {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    grid-template-rows: calc(48px + env(safe-area-inset-top)) minmax(0, 1fr);
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .photos-titlebar { padding-top: env(safe-area-inset-top); }
  .photos-titlebar strong { font-size: 15px; }
  .photos-local { display: none; }
  .photos-close {
    justify-self: start;
    width: auto;
    height: 32px;
    padding-inline: 2px;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #1769e0;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
  }
  .photos-close::after { content: "Done"; }
  .photos-shell { display: block; }
  .photos-sidebar { display: none; }
  .photos-main { height: 100%; }

  .photos-toolbar { padding: 18px 16px 12px; }
  .photos-toolbar h2 { font-size: 25px; }
  .photos-camera { display: none; }

  .photos-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 33vw;
    gap: 2px;
    padding: 0 0 calc(18px + env(safe-area-inset-bottom));
  }

  .photos-card,
  .photos-grid.is-mosaic .photos-card:nth-child(7n + 1),
  .photos-grid.is-mosaic .photos-card:nth-child(7n + 4) { grid-row: span 1; border-radius: 0; }
  .photos-card > span { display: none; }

  .photos-empty { padding: 28px 24px calc(28px + env(safe-area-inset-bottom)); }
  .photos-empty-actions { flex-direction: column; width: min(280px, 100%); }
  .photos-empty button { min-height: 44px; }

  .photos-viewer {
    grid-template-rows: calc(58px + env(safe-area-inset-top)) minmax(0, 1fr) calc(70px + env(safe-area-inset-bottom));
  }

  .photos-viewer-bar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding-top: env(safe-area-inset-top);
    padding-inline: 9px;
  }

  .photos-viewer-bar button { min-height: 38px; padding-inline: 9px; }
  .photos-viewer-title small { display: none; }
  .photos-download { display: none; }
  .photos-viewer-actions { gap: 3px; }
  .photos-viewer-stage { grid-template-columns: 1fr; padding: 8px; }
  .photos-previous, .photos-next { display: none; }
  .photos-filmstrip { padding-bottom: calc(9px + env(safe-area-inset-bottom)); }
  .photos-toast { bottom: calc(20px + env(safe-area-inset-bottom)); }
}

@media (max-width: 460px) {
  .photos-toolbar { gap: 8px; }
  .photos-toolbar h2 { font-size: 23px; }
  .photos-actions button { padding-inline: 10px; }
  .photos-viewer-bar { grid-template-columns: auto minmax(0, 1fr) auto; }
  .photos-viewer-title strong { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .photos-card img,
  .photos-card > span { transition: none; }
}
