:root {
  color: #111;
  background: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --page-padding: clamp(24px, 4vw, 64px);
  --grid-gap-x: clamp(30px, 5vw, 88px);
  --grid-gap-y: clamp(34px, 5vh, 70px);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: #fff;
}

body {
  color: #111;
  -webkit-font-smoothing: antialiased;
}

button {
  color: inherit;
  font: inherit;
}

.site-header {
  position: fixed;
  z-index: 20;
  top: 0;
  right: 0;
  display: flex;
  justify-content: flex-end;
  width: 100%;
  padding: 27px var(--page-padding);
  pointer-events: none;
}

.view-switcher {
  display: flex;
  align-items: center;
  gap: 17px;
  pointer-events: auto;
}

.view-button,
.download-button,
.overlay-close {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #aaa;
  cursor: pointer;
  transition: color 180ms ease;
}

.view-button {
  width: 25px;
  height: 25px;
}

.view-button svg,
.download-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
}

.view-button:hover,
.view-button.is-active,
.download-button:hover,
.overlay-close:hover {
  color: #111;
}

.download-button {
  width: 25px;
  height: 25px;
  color: #aaa;
  text-decoration: none;
}

.carousel-view {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
}

.carousel-viewport {
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
}

.carousel-viewport.is-dragging {
  cursor: grabbing;
}

.carousel-track {
  display: flex;
  width: max-content;
  height: 100%;
  will-change: transform;
}

.carousel-slide {
  display: flex;
  flex: 0 0 100vw;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100%;
  padding: 88px clamp(70px, 10vw, 170px) 64px;
}

.font-display-button,
.grid-card {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.font-display-name {
  display: block;
  max-width: 78vw;
  color: #111;
  font-size: clamp(74px, 13vw, 210px);
  font-weight: 400;
  line-height: 0.92;
  text-align: center;
  white-space: nowrap;
  transition:
    color 180ms ease,
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.font-display-button:hover .font-display-name,
.font-display-button:focus-visible .font-display-name,
.grid-card:hover .font-display-name,
.grid-card:focus-visible .font-display-name {
  transform: scale(1.045);
}

.font-display-button:focus-visible,
.grid-card:focus-visible,
.view-button:focus-visible,
.download-button:focus-visible,
.carousel-arrow:focus-visible,
.overlay-close:focus-visible {
  outline: 1px solid #111;
  outline-offset: 7px;
}

.carousel-arrow {
  position: fixed;
  z-index: 10;
  top: 50%;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #111;
  cursor: pointer;
  transform: translateY(-50%);
  transition: color 180ms ease;
}

.carousel-arrow svg {
  width: 31px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 1.35;
}

.carousel-arrow:hover {
  color: #aaa;
}

.carousel-arrow--previous {
  left: max(8px, calc(var(--page-padding) - 17px));
}

.carousel-arrow--next {
  right: max(8px, calc(var(--page-padding) - 17px));
}

.grid-view {
  display: none;
  min-height: 100vh;
  padding: 98px var(--page-padding) 68px;
}

.font-grid {
  display: grid;
  grid-auto-rows: max(160px, calc((100dvh - 98px - 68px - (2 * var(--grid-gap-y))) / 3));
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--grid-gap-y) var(--grid-gap-x);
}

.grid-card {
  width: 100%;
  height: 100%;
}

.grid-card .font-display-name {
  max-width: 100%;
  font-size: clamp(28px, 4vw, 62px);
  line-height: 1;
}

body[data-mode="carousel"] {
  overflow: hidden;
}

body[data-mode="grid"] {
  overflow-x: hidden;
  overflow-y: auto;
}

body[data-mode="grid"] .carousel-view {
  display: none;
}

body[data-mode="grid"] .grid-view {
  display: block;
}

body.overlay-open {
  overflow: hidden;
}

.font-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
}

.font-overlay[hidden] {
  display: none;
}

.overlay-close {
  position: fixed;
  z-index: 102;
  top: 26px;
  right: var(--page-padding);
  width: 28px;
  height: 28px;
  color: #111;
}

.overlay-close svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
}

.overlay-content {
  width: min(1260px, calc(100% - (2 * var(--page-padding))));
  margin: 0 auto;
  padding: 110px 0 140px;
}

.overlay-heading {
  display: flex;
  align-items: center;
  min-height: 34vh;
  justify-content: center;
}

.overlay-title {
  max-width: 100%;
  margin: 0;
  font-size: clamp(76px, 13vw, 190px);
  font-weight: 400;
  line-height: 0.92;
  text-align: center;
}

.overlay-section {
  padding-top: clamp(90px, 14vw, 180px);
}

.overlay-showcase {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
}

.overlay-image {
  display: block;
  width: 100%;
  max-height: 80vh;
  object-fit: contain;
  object-position: center;
}

.character-set {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: var(--character-size, 62px);
  font-weight: 400;
  letter-spacing: 0.025em;
  line-height: 1.32;
}

.tester-text {
  min-height: 1.4em;
  padding: 10px 0 22px;
  border: 0;
  border-bottom: 1px solid #d8d8d8;
  font-size: var(--tester-size, 84px);
  font-weight: 400;
  line-height: 1.15;
  outline: none;
  overflow-wrap: anywhere;
  transition: border-color 180ms ease;
}

.tester-text:focus {
  border-color: #111;
}

@media (max-width: 900px) {
  .font-grid {
    grid-auto-rows: minmax(190px, 32vh);
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-card .font-display-name {
    font-size: clamp(30px, 8vw, 60px);
  }
}

@media (max-width: 600px) {
  :root {
    --page-padding: 20px;
    --grid-gap-x: 20px;
    --grid-gap-y: 34px;
  }

  .site-header {
    padding-top: 21px;
  }

  .view-switcher {
    gap: 14px;
  }

  .carousel-slide {
    padding: 76px 44px 44px;
  }

  .font-display-name {
    max-width: 82vw;
    font-size: clamp(54px, 19vw, 104px);
  }

  .carousel-arrow {
    width: 40px;
    height: 48px;
  }

  .carousel-arrow svg {
    width: 25px;
  }

  .carousel-arrow--previous {
    left: 1px;
  }

  .carousel-arrow--next {
    right: 1px;
  }

  .grid-view {
    padding-top: 84px;
  }

  .font-grid {
    grid-auto-rows: minmax(160px, 27vh);
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-card .font-display-name {
    font-size: clamp(25px, 9vw, 44px);
  }

  .overlay-close {
    top: 20px;
  }

  .overlay-content {
    padding-top: 92px;
    padding-bottom: 90px;
  }

  .overlay-heading {
    min-height: 26vh;
  }

  .overlay-title {
    font-size: clamp(58px, 20vw, 110px);
  }

  .overlay-section {
    padding-top: 80px;
  }

  .character-set {
    font-size: var(--character-size-mobile, 42px);
  }

  .tester-text {
    font-size: var(--tester-size-mobile, 56px);
  }
}

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