:root {
  color-scheme: light;
  font-family: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Arial Rounded MT Bold", "PingFang SC", system-ui, sans-serif;
  color: #242935;
  background: #f4f4f2;
  font-synthesis: none;
  --paper: #fbfbfa;
  --ink-muted: #737986;
  --accent: #3c70e8;
  --shadow: 0 20px 25px -5px rgb(15 23 42 / 14%), 0 8px 10px -6px rgb(15 23 42 / 14%);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background-color: #f4f4f2;
  background-image:
    radial-gradient(circle, rgb(20 24 31 / 2.8%) 0 0.55px, transparent 0.75px),
    radial-gradient(circle, rgb(255 255 255 / 72%) 0 0.6px, transparent 0.85px),
    linear-gradient(115deg, rgb(255 255 255 / 34%), transparent 46%, rgb(25 28 33 / 1.5%));
  background-position: 0 0, 1px 2px, 0 0;
  background-size: 4px 4px, 7px 7px, 100% 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: transparent;
}

button,
input {
  font: inherit;
}

button,
a,
label {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
.photo-card:focus-visible {
  outline: 3px solid rgb(60 112 232 / 48%);
  outline-offset: 4px;
}

.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: baseline;
  justify-content: center;
  min-height: 88px;
  padding: 27px 88px 16px;
}

.home-link {
  position: absolute;
  top: 16px;
  left: 84px;
  display: flex;
  height: 52px;
  align-items: center;
  color: #252a34;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.16em;
  text-decoration: none;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.round-button {
  display: grid;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid rgb(34 39 48 / 7%);
  border-radius: 50%;
  place-items: center;
  color: #27303b;
  background: rgb(250 250 249 / 92%);
  box-shadow: 0 6px 18px rgb(24 27 34 / 10%);
  cursor: pointer;
}

.settings-button {
  position: fixed;
  z-index: 22;
  top: 16px;
  left: 16px;
  gap: 4px;
  align-content: center;
}

.settings-button span {
  width: 19px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 180ms ease, opacity 180ms ease;
}

.settings-button[aria-expanded="true"] span:first-child {
  transform: translateY(6px) rotate(45deg);
}

.settings-button[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.settings-button[aria-expanded="true"] span:last-child {
  transform: translateY(-6px) rotate(-45deg);
}

.settings-backdrop {
  position: fixed;
  z-index: 19;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgb(24 28 35 / 10%);
  cursor: default;
}

.settings-panel {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  width: min(512px, calc(100vw - 18px));
  padding: 20px 18px 18px;
  border-radius: 0 0 24px 0;
  background: rgb(250 250 249 / 96%);
  box-shadow: 0 18px 44px rgb(25 29 36 / 18%);
  backdrop-filter: blur(14px);
}

.panel-handle {
  width: 50px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 99px;
  background: #cbd0d8;
}

.eyebrow {
  margin: 0 0 14px;
  color: #707784;
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.22em;
  text-align: center;
  text-transform: uppercase;
}

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

.control-card {
  display: flex;
  min-height: 72px;
  padding: 14px 16px;
  border: 1px solid rgb(41 47 57 / 8%);
  border-radius: 18px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #353b47;
  background: #fff;
  box-shadow: 0 5px 12px rgb(24 27 33 / 6%);
  font-size: 0.9rem;
  font-weight: 720;
}

.control-card input {
  position: relative;
  flex: 0 0 auto;
  width: 56px;
  height: 32px;
  margin: 0;
  border-radius: 99px;
  appearance: none;
  background: #d8dbe0;
  cursor: pointer;
  transition: background 160ms ease;
}

.control-card input::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 5px rgb(16 20 28 / 22%);
  content: "";
  transition: transform 160ms ease;
}

.control-card input:checked {
  background: var(--accent);
}

.control-card input:checked::after {
  transform: translateX(24px);
}

.count-card strong {
  font-size: 1.45rem;
}

.status {
  width: min(560px, calc(100% - 40px));
  margin: 18vh auto 0;
  color: var(--ink-muted);
  line-height: 1.6;
  text-align: center;
}

.status[data-kind="error"] {
  color: #9b3434;
}

.album-list,
.photo-wall {
  display: flex;
  width: min(1720px, 100%);
  margin: 8px auto 110px;
  padding: clamp(38px, 6vw, 80px) clamp(20px, 2vw, 36px);
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: clamp(76px, 8vw, 112px) clamp(34px, 4vw, 64px);
}

.album-list {
  margin-bottom: 100px;
}

.polaroid {
  position: relative;
  display: flex;
  padding: 31.2px 30.4px 0;
  flex-direction: column;
  isolation: isolate;
  color: #262b33;
  background: linear-gradient(#fff, rgb(252 252 252 / 98%));
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgb(255 255 255 / 80%),
    inset 0 -1px 0 rgb(203 213 225 / 42%);
}

.polaroid::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(rgb(248 248 248 / 92%), rgb(239 239 239 / 90%));
  content: "";
  filter: blur(0.35px);
  opacity: 0.28;
  transform: translate(1px, 1.5px);
}

.polaroid-frame {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  overflow: hidden;
  background: #f4f1ea;
  box-shadow:
    inset 0 0 0 1px rgb(58 43 27 / 10%),
    inset 0 1px 1px rgb(255 255 255 / 48%),
    inset 0 3px 6px rgb(255 255 255 / 16%),
    inset 0 -12px 24px rgb(30 20 11 / 18%),
    inset 10px 0 18px rgb(38 26 15 / 10%),
    inset -10px 0 18px rgb(38 26 15 / 10%);
}

.polaroid-frame::before,
.polaroid-frame::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
}

.polaroid-frame::before {
  z-index: 1;
  background:
    radial-gradient(circle at 50% 18%, rgb(255 255 255 / 20%), transparent 42%),
    linear-gradient(transparent 58%, rgb(22 15 9 / 10%));
  mix-blend-mode: soft-light;
  opacity: 0.85;
}

.polaroid-frame::after {
  z-index: 2;
  box-shadow:
    inset 0 0 28px rgb(24 16 10 / 14%),
    inset 0 0 4px rgb(20 12 7 / 16%),
    inset 0 1px 1px rgb(255 255 255 / 22%);
}

.polaroid-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.polaroid-meta {
  display: flex;
  width: 100%;
  height: 96px;
  min-height: 96px;
  margin: 0;
  padding: 0 0 20px;
  flex: 0 0 96px;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 2px;
  line-height: 1.15;
  text-align: right;
}

.wall-polaroid {
  opacity: 0;
  transform: rotate(var(--tilt));
  transition:
    opacity 320ms ease var(--reveal-delay),
    transform 180ms ease,
    box-shadow 180ms ease;
}

.wall-polaroid.is-revealed {
  opacity: 1;
  transform: rotate(var(--tilt));
}

.album-link {
  width: min(var(--card-width), calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  min-width: 0;
  color: #252a34;
  text-decoration: none;
}

.album-link.is-revealed:hover {
  box-shadow: 0 24px 48px rgb(31 35 44 / 18%);
  transform: rotate(var(--tilt)) translateY(-3px);
}

.album-cover {
  aspect-ratio: 4 / 3;
}

.album-cover img {
  opacity: 0;
  transform: none;
  transition: opacity 200ms ease;
}

.album-cover img.is-loaded {
  opacity: 1;
}

.album-cover.is-empty::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #969ba3;
  content: "No photos";
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.album-info {
  padding: 0 0 20px;
}

.album-info strong {
  overflow: hidden;
  font-family: inherit;
  max-width: 100%;
  font-size: 1.25rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.album-count {
  flex: 0 0 auto;
  color: var(--ink-muted);
  font-size: 0.86rem;
  font-weight: 520;
}

.photo-card {
  width: min(var(--card-width), calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  margin: var(--lift) 0 0;
  border: 0;
  cursor: zoom-in;
}

.photo-card.is-revealed:hover {
  z-index: 1;
  box-shadow: 0 24px 48px rgb(31 35 44 / 19%), 0 4px 10px rgb(31 35 44 / 10%);
  transform: rotate(var(--tilt)) translateY(-4px);
}

.photo-frame {
  flex: 0 0 auto;
}

.photo-frame img {
  transition: opacity 180ms ease;
}

.photo-frame img:not(.is-loaded) {
  opacity: 0;
}

.photo-frame img.is-broken {
  opacity: 0;
}

.photo-meta {
  position: static;
  padding: 0 0 20px;
}

.photo-name {
  overflow: hidden;
  font-family: inherit;
  max-width: 100%;
  font-size: 1.25rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-time {
  flex: 0 0 auto;
  color: #686c73;
  font-size: 0.86rem;
  font-weight: 520;
}

.lightbox {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  color: #282d36;
  background: rgb(245 245 243 / 93%);
  backdrop-filter: blur(12px);
  opacity: 0;
}

.lightbox::backdrop {
  background: rgb(239 239 237 / 86%);
}

.lightbox[open] {
  display: block;
  opacity: 1;
}

.lightbox.is-opening {
  animation: lightbox-fade-in 180ms ease-out both;
}

.lightbox.is-opening::backdrop {
  animation: lightbox-backdrop-in 180ms ease-out both;
}

.lightbox.is-opening .lightbox-figure {
  animation: lightbox-figure-in 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.lightbox.is-closing {
  pointer-events: none;
  animation: lightbox-fade-out 160ms ease-in both;
}

.lightbox.is-closing::backdrop {
  animation: lightbox-backdrop-out 160ms ease-in both;
}

.lightbox.is-closing .lightbox-figure {
  animation: lightbox-figure-out 160ms ease-in both;
}

@keyframes lightbox-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes lightbox-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes lightbox-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes lightbox-backdrop-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes lightbox-figure-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes lightbox-figure-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
}

.lightbox-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.lightbox-track {
  display: flex;
  width: 100%;
  height: 100%;
  transform: translateX(-100%);
  will-change: transform;
}

.lightbox-track.is-animating {
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.lightbox-slide {
  display: flex;
  min-width: 100%;
  height: 100%;
  padding: clamp(64px, 7vw, 88px) clamp(64px, 8vw, 112px);
  align-items: center;
  justify-content: center;
  transition: padding 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.lightbox-figure {
  width: min(var(--card-width), calc(100vw - 24px));
  max-width: none;
  max-height: none;
  margin: 0;
  box-shadow: 0 26px 64px rgb(25 29 36 / 22%), 0 4px 10px rgb(25 29 36 / 10%);
  transition:
    width 280ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 220ms ease;
}

.lightbox-frame {
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  color: inherit;
  cursor: zoom-in;
  touch-action: manipulation;
}

.lightbox-frame img {
  opacity: 0;
  transition: opacity 160ms ease;
}

.lightbox-frame img.is-loaded {
  opacity: 1;
}

.lightbox-caption {
  padding: 0 0 20px;
  opacity: 1;
  transition: opacity 180ms ease;
}

.lightbox.is-zoomed .lightbox-slide {
  padding: 24px 32px;
}

.lightbox.is-zoomed .lightbox-slide[aria-hidden="false"] .lightbox-figure {
  width: min(var(--zoom-card-width), calc(100vw - 24px));
  box-shadow: 0 32px 76px rgb(25 29 36 / 24%), 0 5px 12px rgb(25 29 36 / 11%);
}

.lightbox.is-zoomed .lightbox-slide[aria-hidden="false"] .lightbox-frame {
  cursor: zoom-out;
}

.lightbox.is-zoomed .lightbox-slide[aria-hidden="false"] .lightbox-caption {
  opacity: 0;
}

.lightbox-name {
  overflow: hidden;
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox-time {
  flex: 0 0 auto;
  color: #686c73;
  font-size: 0.86rem;
  font-weight: 520;
}

.lightbox-close {
  position: fixed;
  z-index: 4;
  top: 16px;
  right: 16px;
  font-size: 0;
}

.lightbox-close::before,
.lightbox-close::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 2.5px;
  border-radius: 99px;
  background: currentColor;
  content: "";
}

.lightbox-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.lightbox-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.lightbox-nav {
  position: fixed;
  z-index: 2;
  top: 0;
  bottom: 0;
  width: 22vw;
  min-width: 80px;
  height: 100%;
  padding: 0;
  border: 0;
  color: #303641;
  background: linear-gradient(90deg, rgb(255 255 255 / 0%), transparent);
  font-size: 3.25rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.42;
  transition: opacity 180ms ease;
}

.lightbox-nav:hover,
.lightbox-nav:focus-visible {
  opacity: 1;
}

.lightbox-nav:focus-visible {
  outline: 0;
  color: var(--accent);
  text-shadow: 0 0 18px rgb(60 112 232 / 24%);
}

.lightbox-previous {
  left: 0;
  text-align: left;
  padding-left: 18px;
}

.lightbox-next {
  right: 0;
  text-align: right;
  padding-right: 18px;
}

body.lightbox-open {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

@media (max-width: 680px) {
  .site-header {
    min-height: 76px;
    padding: 23px 72px 12px;
  }

  .home-link {
    top: 12px;
    left: 72px;
    display: flex;
    height: 48px;
    font-size: 0.68rem;
  }

  .page-title {
    max-width: 100%;
    overflow: hidden;
    font-size: 0.92rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .round-button {
    width: 48px;
    height: 48px;
  }

  .settings-button {
    top: 12px;
    left: 12px;
  }

  .settings-panel {
    width: 100%;
    max-height: min(86vh, 580px);
    padding: 17px 12px 14px;
    border-radius: 0 0 22px 22px;
    overflow-y: auto;
  }

  .controls-grid {
    gap: 9px;
  }

  .control-card {
    min-height: 68px;
    padding: 11px 12px;
    font-size: 0.79rem;
  }

  .control-card input {
    width: 50px;
    height: 30px;
  }

  .control-card input::after {
    width: 22px;
    height: 22px;
  }

  .control-card input:checked::after {
    transform: translateX(20px);
  }

  .photo-wall {
    width: 100%;
    margin-top: 4px;
    padding: 30px 0 80px;
    align-items: center;
    justify-content: center;
    gap: 82px;
  }

  .album-list {
    width: 100%;
    margin-top: 4px;
    padding: 30px 0 80px;
    align-items: center;
    justify-content: center;
    gap: 82px;
  }

  .album-info {
    min-height: 0;
    padding: 0 0 20px;
  }

  .photo-card {
    max-width: calc(100vw - 24px);
    margin-top: 0;
  }

  .photo-meta {
    padding: 0 0 20px;
  }

  .lightbox-slide {
    padding: 64px 12px 74px;
  }

  .lightbox-figure {
    width: min(var(--card-width), calc(100vw - 24px));
    max-width: none;
  }

  .lightbox-caption {
    gap: 2px;
  }

  .lightbox-nav {
    top: 0;
    bottom: 0;
    width: 18vw;
    min-width: 64px;
    height: 100%;
  }

  .lightbox-previous {
    left: 0;
    padding-left: 10px;
  }

  .lightbox-next {
    right: 0;
    padding-right: 10px;
  }
}

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

  .wall-polaroid {
    opacity: 1;
    transform: rotate(var(--tilt));
  }
}
