:root {
  color-scheme: dark;
  --background: #101114;
  --surface: #191b20;
  --surface-light: #252830;
  --text: #f4f5f7;
  --muted: #aeb3bd;
  --accent: #8ab4ff;
  --danger: #ff9c9c;
  --footer-height: 4.5rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--background);
}

body {
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

button,
a {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.home-page {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: 1.5rem;
}

.home-content {
  max-width: 32rem;
  color: var(--muted);
  font-size: 1.05rem;
  text-align: center;
}

.app-shell {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100svh;
  min-height: 100svh;
  max-height: 100svh;
  overflow: hidden;
}

h2,
p {
  margin: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.counter {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.counter span:first-child {
  color: var(--text);
  font-weight: 700;
}

.viewer {
  position: relative;
  display: flex;
  height: calc(100svh - var(--footer-height));
  min-height: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: .75rem 4.25rem;
  touch-action: pan-y;
  user-select: none;
}

.status-panel {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: .7rem;
  max-width: min(90%, 30rem);
  padding: .95rem 1.15rem;
  color: var(--muted);
  text-align: center;
}

.status-panel.is-error {
  color: var(--danger);
}

.spinner {
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, .2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.status-panel.is-error .spinner {
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.slide-stage {
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin: 0;
}

.image-button {
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: zoom-in;
  touch-action: pan-y;
}

.image-button img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100svh - var(--footer-height) - 1.5rem);
  object-fit: contain;
  border-radius: .2rem;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, .25);
  pointer-events: none;
}

.slide-error {
  max-width: 22rem;
  color: var(--danger);
  text-align: center;
}

.nav-button,
.close-button {
  display: grid;
  place-items: center;
  border: 0;
  color: var(--text);
  background: rgba(255, 255, 255, .1);
  cursor: pointer;
}

.nav-button {
  position: absolute;
  z-index: 1;
  width: 3rem;
  height: 4.5rem;
  border-radius: 1rem;
  font-size: 2.5rem;
  line-height: 1;
}

.nav-button:hover,
.nav-button:active,
.close-button:hover,
.secondary-button:hover {
  background: var(--surface-light);
}

.nav-button:disabled {
  cursor: default;
  opacity: .25;
}

.nav-button--previous { left: 1rem; }
.nav-button--next { right: 1rem; }

.app-footer {
  display: flex;
  min-height: var(--footer-height);
  align-items: center;
  justify-content: flex-start;
  gap: .65rem;
  padding: .75rem max(1rem, env(safe-area-inset-right)) max(.75rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.secondary-button {
  min-height: 2.7rem;
  padding: .55rem .95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: .7rem;
  cursor: pointer;
}

.steps-panel {
  position: fixed;
  z-index: 4;
  right: 0;
  bottom: 0;
  left: 0;
  max-height: min(80svh, 36rem);
  overflow: auto;
  padding: 1rem max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  background: var(--surface);
  border-top: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 -1rem 3rem rgba(0, 0, 0, .35);
}

.steps-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
}

.steps-panel h2 {
  font-size: 1.05rem;
}

.close-button {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  font-size: 1.5rem;
}

.steps-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
}

.step-link {
  width: 3.5rem;
  min-width: 3.5rem;
  min-height: 2.8rem;
  padding: .6rem;
  color: var(--muted);
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: .6rem;
  cursor: pointer;
  text-align: center;
}

.step-link.is-current {
  color: var(--text);
  background: rgba(138, 180, 255, .16);
  border-color: var(--accent);
}

.pswp__error-msg {
  max-width: 18rem;
  padding: 1rem;
  color: var(--danger);
  text-align: center;
}

@media (max-width: 36rem) {
  .viewer {
    padding-right: 2.9rem;
    padding-left: 2.9rem;
  }

  .nav-button {
    width: 2.25rem;
    height: 3.5rem;
    border-radius: .75rem;
    font-size: 2rem;
  }

  .nav-button--previous { left: .35rem; }
  .nav-button--next { right: .35rem; }

  .app-footer {
    gap: .45rem;
  }

  .secondary-button {
    flex: 1 1 0;
    padding-right: .55rem;
    padding-left: .55rem;
    font-size: .88rem;
  }
}

@media (min-width: 36.01rem) {
  .app-footer {
    justify-content: center;
  }
}

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