/* No blue flash on tap and no rubber-band stretch at the ends of the page. */
html {
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

/* Sized to the largest the viewport gets, so a phone's address bar sliding away never resizes the
   background. Before WebGL is up, or if it never comes up, the canvas is just the flat grid. */
#grid-wave {
  top: 0;
  bottom: auto;
  height: 100vh;
  height: 100lvh;
  background-color: #04060d;
  background-image:
    linear-gradient(rgba(144, 176, 255, 0.13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(144, 176, 255, 0.13) 1px, transparent 1px);
  background-size: 48px 48px;
}

.glass-on body.grid-background::before {
  display: none;
}

/* Running text sits directly on the shapes, so it carries a soft dark edge for when a bright lip passes behind it. */
.glass-on body.grid-background p,
.glass-on body.grid-background li,
.glass-on body.grid-background figcaption {
  text-shadow: 0 0 10px rgba(2, 4, 10, 0.9), 0 1px 3px rgba(2, 4, 10, 0.7);
}

/* With a mouse, the shader draws the glass, so these only clear the way for it. */
.glass-shader .site-nav:not(.products-open):not(:has(.nav-menu.is-open)),
.glass-shader .glass-card,
.glass-shader .product-feature,
.glass-shader .product-link,
.glass-shader .hero-cta,
.glass-shader .wl-btn,
.glass-shader .btn-primary,
.glass-shader .btn-secondary,
.glass-shader .sq-btn-primary,
.glass-shader .sq-btn-secondary {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

.glass-shader .product-feature::before,
.glass-shader .product-feature::after {
  display: none !important;
}

/* CSS glass, for a touchscreen until a pane has its own copy of the shader glass, or if the phone can't keep up. */
.glass-touch .site-nav,
.glass-touch .glass-card,
.glass-touch .product-feature,
.glass-touch .product-link,
.glass-touch .hero-cta,
.glass-touch .wl-btn,
.glass-touch .btn-primary,
.glass-touch .btn-secondary,
.glass-touch .sq-btn-primary,
.glass-touch .sq-btn-secondary {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)), rgba(8, 10, 16, 0.42) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16) !important;
  -webkit-backdrop-filter: blur(12px) saturate(1.15) !important;
  backdrop-filter: blur(12px) saturate(1.15) !important;
}

.glass-touch .product-feature::before,
.glass-touch .product-feature::after {
  display: none !important;
}

.glass-touch .glass-lensed {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

.glass-on .hero-cta,
.glass-on .product-link,
.glass-on .wl-btn,
.glass-on .btn-primary,
.glass-on .btn-secondary,
.glass-on .sq-btn-primary,
.glass-on .sq-btn-secondary {
  color: #f2f4f7 !important;
  transition: opacity 0.15s ease, transform 0.2s ease;
}

@media (hover: hover) {
  .glass-on .hero-cta:hover,
  .glass-on .product-feature:hover .product-link,
  .glass-on .wl-btn:hover:not(:disabled),
  .glass-on .btn-primary:hover,
  .glass-on .btn-secondary:hover,
  .glass-on .sq-btn-primary:hover,
  .glass-on .sq-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08) !important;
  }
}

/* Taps answer with a dim instead of the browser's highlight. */
.glass-on .hero-cta:active,
.glass-on .product-link:active,
.glass-on .wl-btn:active:not(:disabled),
.glass-on .btn-primary:active,
.glass-on .btn-secondary:active,
.glass-on .sq-btn-primary:active,
.glass-on .sq-btn-secondary:active,
.site-nav a:active,
.site-nav button:active {
  opacity: 0.65;
}

/* An open menu is frosted by the blurred page behind it, drawn by .nav-backdrop. */
.glass-on .site-nav.products-open,
.glass-on .site-nav.products-open .nav-dropdown {
  background: rgba(10, 12, 18, 0.62);
}

@media (max-width: 520px) {
  .glass-on .nav-menu {
    background: rgba(10, 12, 18, 0.66);
  }
}

/* The waitlist field. Its messages come from waitlist.js rather than the browser's bubble. */
.wl-input[aria-invalid="true"] {
  border-color: rgba(252, 165, 165, 0.7);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.16);
}

/* 16px keeps iPhones from zooming the page in when the field is tapped. */
@media (max-width: 520px) {
  .wl-form .wl-input {
    font-size: 16px;
  }
}

/* The devlog reads on one glass slab, with its chapter list floating beside it. */
.glass-on body[data-reading] .content-wrapper {
  box-sizing: border-box;
  max-width: calc(780px + 2 * clamp(1.25rem, 4vw, 3.5rem));
  padding-inline: clamp(1.25rem, 4vw, 3.5rem);
  border-radius: 28px;
}

.glass-touch body[data-reading] .content-wrapper {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(6, 8, 14, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.glass-on .chapter-nav {
  border-left: 0;
  border-radius: 16px;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

@media (max-width: 1200px) {
  .glass-on body[data-reading] .content-wrapper {
    max-width: calc(640px + 2 * clamp(1.25rem, 4vw, 3.5rem));
  }
}

@media (max-width: 999px) {
  .glass-on body[data-reading] .content-wrapper {
    max-width: calc(780px + 2 * clamp(1.25rem, 4vw, 3.5rem));
  }
}
