*,
*::after,
*::before {
  box-sizing: border-box;
}

:root {
  font-size: 16px;
  --color-text: #fff;
  --color-bg: #000;
  --color-link: #fff;
  --color-link-hover: #fff;
}

body {
  margin: 0;
  padding: 0;
  color: var(--color-text);
  background-color: var(--color-bg);
  font-family: 'area-normal', -apple-system, BlinkMacSystemFont, Segoe UI,
    Helvetica, Arial, sans-serif;
  font-family: 'anonymous-pro', monospace;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

main {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

html {
  height: 100%;
  width: 100%;
}

/* Page Loader */
.js .loading::before,
.js .loading::after {
  content: '';
  position: fixed;
  z-index: 1000;
}

.js .loading::before {
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-bg);
}

.js .loading::after {
  top: 50%;
  left: 50%;
  width: 60px;
  height: 60px;
  margin: -30px 0 0 -30px;
  border-radius: 50%;
  opacity: 0.4;
  background: var(--color-link);
  animation: loaderAnim 0.7s linear infinite alternate forwards;
}

@keyframes loaderAnim {
  to {
    opacity: 1;
    transform: scale3d(0.5, 0.5, 1);
  }
}

a {
  text-decoration: none;
  color: var(--color-link);
  outline: none;
  cursor: pointer;
}

a:hover {
  color: var(--color-link-hover);
  outline: none;
}

/* Better focus styles from https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible */
a:focus {
  /* Provide a fallback style for browsers
	 that don't support :focus-visible */
  outline: none;
  background: lightgrey;
}

a:focus:not(:focus-visible) {
  /* Remove the focus indicator on mouse-focus for browsers
	 that do support :focus-visible */
  background: transparent;
}

a:focus-visible {
  /* Draw a very noticeable focus style for
	 keyboard-focus on browsers that do support
	 :focus-visible */
  outline: 2px solid red;
  background: transparent;
}

.unbutton {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  cursor: pointer;
}

.unbutton:focus {
  outline: none;
}

.frame {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  color: var(--color-title);
  padding: 2rem;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto auto 1fr;
  grid-template-areas: 'title title' 'prev back' 'demos demos' 'sponsor sponsor' 'nav nav';
  justify-content: start;
  align-content: start;
  align-items: start;
  z-index: 100;
  pointer-events: none;
  grid-gap: 1rem;
}

body #cdawrap {
  align-self: start;
  justify-self: start;
}

.frame a,
.frame button {
  pointer-events: auto;
}

.frame__title {
  grid-area: title;
  display: flex;
  align-items: flex-end;
  font-weight: 400;
}

.frame strong {
  font-weight: 700;
}

.frame__title-main {
  font-size: inherit;
  margin: 0;
  font-weight: inherit;
}

.frame__back {
  grid-area: back;
}

.frame__prev {
  grid-area: prev;
}

.frame__demos {
  grid-area: demos;
  display: grid;
  grid-template-columns: repeat(8, auto);
  column-gap: 1rem;
  row-gap: 0.5rem;
}

.frame__demos span {
  grid-column: 1 / span 8;
}

a.frame__demo {
  font-weight: 400;
  font-size: 1rem;
  text-decoration: none;
  opacity: 0.5;
  font-family: 'anonymous-pro', monospace;
}

a.frame__demo--current {
  font-weight: 700;
  opacity: 1;
  color: var(--color-link-hover);
}

.slides {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-rows: 100%;
  grid-template-columns: 100%;
  place-items: center;
}

.slide {
  width: 100%;
  height: 100%;
  grid-area: 1 / 1 / -1 / -1;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
  position: relative;
  display: grid;
  place-items: center;
  will-change: transform, opacity;
}

.slide--current {
  pointer-events: auto;
  opacity: 1;
}

.deco {
  width: 100%;
  height: 100%;
  grid-area: 1 / 1 / -1 / -1;
  pointer-events: none;
  position: relative;
  opacity: 0;
  background: #8c718e;
  will-change: transform, opacity;
}

.deco--1 {
  background: #d4503e;
}

.deco--2 {
  background: #1c1a1a;
}

.deco--3 {
  background: #4e4141;
}

.deco--4 {
  background: #000;
}

.deco--5 {
  background: #060b17;
}

.deco--6 {
  background: #34365c;
}

.deco--7 {
  background: #9f6794;
}

.slide__img {
  width: 100%;
  height: 100%;
  background-size: contain;
  background-position: center center;
  background-repeat: no-repeat;
  will-change: transform, opacity, filter;
  object-fit: contain;
}

.demo-2 .slide__img {
  width: 120%;
  height: 120%;
}

.slides-nav {
  grid-area: nav;
  display: flex;
  gap: 0.5rem;
  align-self: end;
  align-items: center;
}

.slides-nav::before {
  content: 'scroll / drag';
  margin-right: 2rem;
}

.slides-nav__item {
  border: 0;
  background: #fff;
  color: #000;
  width: 60px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.3s;
}

.slides-nav__item:hover {
  background-color: #ccc;
}

@media screen and (min-width: 53em) {
  .frame {
    height: 100vh;
    grid-gap: 2rem;
    align-content: space-between;
    grid-template-columns: auto auto auto 1fr;
    grid-template-rows: auto auto;
    grid-template-areas: 'title back prev demos' 'sponsor ... ... nav ';
  }

  .frame__demos {
    justify-self: end;
    justify-content: end;
  }

  .frame__demos span,
  a.frame__demo {
    text-align: right;
  }

  .slides-nav {
    justify-self: end;
  }

  body #cdawrap {
    align-self: center;
    justify-self: start;
  }
}

/* Responsive styles for better image display on all devices */
@media (max-width: 768px) {
  .slides {
    height: 100vh;
    width: 100vw;
  }
  
  .slide {
    padding: 1rem;
  }
  
  .slide__img {
    background-size: contain;
    max-width: 100%;
    max-height: 100%;
  }
}

@media (max-width: 480px) {
  .slide {
    padding: 0.5rem;
  }
}

/* Ensure images fit properly on larger screens */
@media (min-width: 1200px) {
  .slide__img {
    background-size: contain;
    max-width: 90vw;
    max-height: 90vh;
  }
}

/* For landscape orientation on mobile */
@media (orientation: landscape) and (max-height: 600px) {
  .slides {
    height: 100vh;
  }
  
  .slide__img {
    background-size: contain;
    width: 100%;
    height: 100%;
  }
}

/* Clickable slide styles */
.slide--clickable {
  cursor: pointer;
  position: relative;
}

.slide__link {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease;
  opacity: 0;
  pointer-events: none;
}

.slide--clickable:hover .slide__overlay {
  background: rgba(0, 0, 0, 0.3);
  opacity: 1;
  pointer-events: auto;
}

.slide__cta {
  background: rgba(255, 255, 255, 0.9);
  color: #000;
  padding: 1rem 2rem;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'anonymous-pro', monospace;
  font-weight: bold;
  font-size: 1.1rem;
  transform: translateY(20px);
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.slide--clickable:hover .slide__cta {
  transform: translateY(0);
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.slide__cta-text {
  font-size: 1rem;
  letter-spacing: 0.5px;
}

.slide__cta-arrow {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
}

.slide--clickable:hover .slide__cta-arrow {
  transform: translateX(5px);
}

/* Mobile responsive styles for clickable slide */
@media (max-width: 768px) {
  .slide__cta {
    padding: 0.8rem 1.5rem;
    font-size: 0.9rem;
  }
  
  .slide__cta-text {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .slide__cta {
    padding: 0.6rem 1.2rem;
    font-size: 0.8rem;
  }
  
  .slide__cta-text {
    font-size: 0.75rem;
  }
}

/* Touch devices - show overlay on touch */
@media (hover: none) and (pointer: coarse) {
  .slide__overlay {
    opacity: 0.8;
    pointer-events: auto;
  }
  
  .slide__cta {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.95);
  }
}

/* Progress Indicator Styles */
.progress-indicator {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: 'anonymous-pro', monospace;
  color: #fff;
}

.progress-bar {
  width: 100px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #fff, #ccc);
  border-radius: 2px;
  width: 5.26%; /* 1/19 = 5.26% for first slide */
  transition: width 0.8s ease;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.progress-text {
  font-size: 0.9rem;
  font-weight: bold;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  padding: 0.3rem 0.6rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.progress-current {
  color: #fff;
  font-weight: bold;
}

.progress-total {
  color: rgba(255, 255, 255, 0.7);
}

/* Mobile responsive styles for progress indicator */
@media (max-width: 768px) {
  .progress-indicator {
    top: 1rem;
    right: 1rem;
    gap: 0.5rem;
  }
  
  .progress-bar {
    width: 60px;
    height: 3px;
  }
  
  .progress-text {
    font-size: 0.8rem;
    padding: 0.2rem 0.4rem;
  }
}

@media (max-width: 480px) {
  .progress-indicator {
    top: 0.5rem;
    right: 0.5rem;
  }
  
  .progress-bar {
    width: 50px;
  }
  
  .progress-text {
    font-size: 0.75rem;
  }
}

/* Hide progress indicator on very small screens if needed */
@media (max-width: 320px) {
  .progress-indicator {
    top: 0.3rem;
    right: 0.3rem;
  }
  
  .progress-bar {
    width: 40px;
    height: 2px;
  }
}
