:root {
  color-scheme: light;
  overflow: hidden;
  overscroll-behavior-y: none;
  touch-action: pinch-zoom;
  background: #f8f8f8;
  --title-ink: #0a0a0a;
  color: var(--title-ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100dvh;
  touch-action: pinch-zoom;
  isolation: isolate;
  --safe-x: max(env(safe-area-inset-left), env(safe-area-inset-right));
  --safe-y: max(env(safe-area-inset-top), env(safe-area-inset-bottom));
  --paper-grid-opacity: 7%;
  --paper-inset-x: max(var(--safe-x), min(20px, 25dvw));
  --paper-inset-y: max(var(--safe-y), min(20px, 25dvh));
  --footer-length: calc(100dvh - 2 * var(--paper-inset-y));
  --footer-count: 16;
  --footer-cell: calc(var(--footer-length) / var(--footer-count));
  --footer-edge-inset: var(--paper-inset-x);
  --footer-inner-padding: 0px;
  --footer-outer-inset: calc(
    var(--footer-outer-scale, 2) * var(--footer-edge-inset)
  );
  --tile-brand-ratio: 0.8;
  --tile-brand-scale: calc(100% * var(--tile-brand-ratio));
  --footer-icon-stroke: 5.5;
  --tile-corner-inset-x: var(--footer-outer-inset);
  --tile-corner-inset-y: var(--paper-inset-y);
  --footer-depth: calc(
    var(--footer-cell) + var(--footer-inner-padding) + var(--footer-outer-inset)
  );
  --bar-color: transparent;
  --turn: 0deg;
  --gradient-direction: to right;
  --mark-ink: #646464;
}

/* Keep the Sandbox animation and footer at their experimental spacing. */
body:has(> .backdrop > .billows) {
  --footer-outer-scale: 1;
  --footer-inner-padding: var(--footer-edge-inset);
}

.sandbox {
  --paper-grid-opacity: 4%;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: #f8f8f8;
  padding: var(--safe-y) var(--safe-x);
}

.backdrop svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: rgb(102 102 102 / var(--paper-grid-opacity));
  shape-rendering: crispEdges;
}

.backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Cpath fill='%23fff' filter='url(%23noise)' d='M0 0h400v400H0z'/%3E%3C/svg%3E");
  opacity: 0.03;
  mix-blend-mode: overlay;
}

.product {
  --mark-ink: #f3f6ff;
  --bar-color: rgb(var(--accent-rgb));
  --fit: 0.5;
}

.product .backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  --footer-start: calc(100% - var(--footer-depth));
  /* Evenly spaced samples of the smoothstep opacity curve between paper and footer. */
  background: linear-gradient(
    var(--gradient-direction),
    transparent calc(var(--footer-start) - 20%),
    rgb(var(--accent-rgb) / 4.3%),
    rgb(var(--accent-rgb) / 15.6%),
    rgb(var(--accent-rgb) / 31.6%),
    rgb(var(--accent-rgb) / 50%),
    rgb(var(--accent-rgb) / 68.4%),
    rgb(var(--accent-rgb) / 84.4%),
    rgb(var(--accent-rgb) / 95.7%),
    var(--bar-color) var(--footer-start)
  );
}

main {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  display: grid;
  grid-template: 100% / 100%;
  place-items: center;
  overflow: clip;
  user-select: none;
  -webkit-user-select: none;
}

.title-axis {
  width: max-content;
  transform: rotate(var(--turn)) scale(var(--fit, 1));
}

h1 {
  margin: 0;
  font:
    700 min(30vmax, 52vmin, 32rem) / 1 "IBM Plex Serif",
    Georgia,
    serif;
  text-box: trim-both ex alphabetic;
  white-space: nowrap;
  letter-spacing: -0.06em;
  transform: perspective(var(--depth, 200vmax));
}

.secondary {
  font-weight: 200;
}

footer {
  position: fixed;
  inset: 0 0 0 auto;
  box-sizing: border-box;
  width: var(--footer-depth);
  padding: var(--tile-corner-inset-y) var(--tile-corner-inset-x)
    var(--tile-corner-inset-y) var(--footer-inner-padding);
  display: grid;
  grid-template: repeat(var(--footer-count), minmax(0, 1fr)) / 100%;
  background: var(--bar-color);
  color: var(--mark-ink);
  pointer-events: none;
}

.footer-lines {
  grid-area: 1 / 1 / -1 / -1;
  width: 100%;
  height: 100%;
  outline: 1px solid currentColor;
  outline-offset: -1px;
  fill: none;
  stroke: currentColor;
  shape-rendering: crispEdges;
  opacity: 0;
}

.maker,
.plus {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
}

.maker {
  grid-area: -2 / 1;
  pointer-events: auto;
  color: inherit;
}

.maker img,
.maker .ashcee-eye {
  display: block;
  width: var(--tile-brand-scale);
  height: auto;
}

.ashcee-eye-outline {
  display: none;
}

.home .maker--home .ashcee-eye {
  /* The pointed caps extend beyond the SVG viewBox but stay inside the tile. */
  overflow: visible;
}

.home .maker--home .ashcee-eye-outline {
  display: inline;
  stroke: currentColor;
  /* Match half the plus weight in screen space. The almond masks the inner
     half of this stroke, and the ratio accounts for the smaller eye viewBox. */
  stroke-width: calc(var(--footer-icon-stroke) / var(--tile-brand-ratio));
  stroke-linejoin: miter;
}

.product .maker img {
  filter: brightness(0) invert(96%);
}

.maker:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}

.plus {
  grid-area: 1 / 1;
}

.plus-glyph {
  width: 100%;
  height: 100%;
  fill: currentColor;
  pointer-events: none;
}

.plus-glyph path[stroke-width] {
  fill: none;
  stroke: currentColor;
  stroke-linejoin: round;
}

.plus-glyph path[hidden] {
  display: none;
}

@media (any-hover: hover) and (prefers-reduced-motion: no-preference) {
  .plus[data-glyph-cycle] {
    pointer-events: auto;
  }
}

.plus:not([data-glyph-cycle])::before,
.plus:not([data-glyph-cycle])::after {
  content: "";
  grid-area: 1 / 1;
  width: 40%;
  height: min(1.5px, 5%);
  background: currentColor;
}

.plus:not([data-glyph-cycle])::after {
  width: min(1.5px, 5%);
  height: 40%;
}

@media (aspect-ratio < 1/1) {
  body {
    --turn: 90deg;
    --gradient-direction: to bottom;
    --footer-length: calc(100dvw - 2 * var(--paper-inset-x));
    --footer-count: 6;
    --footer-edge-inset: var(--paper-inset-y);
    --footer-outer-scale: 1;
    --tile-corner-inset-x: var(--paper-inset-x);
    --tile-corner-inset-y: var(--footer-outer-inset);
  }

  footer {
    inset: auto 0 0;
    width: auto;
    height: var(--footer-depth);
    padding: var(--footer-inner-padding) var(--tile-corner-inset-x)
      var(--tile-corner-inset-y);
    grid-template: 100% / repeat(var(--footer-count), minmax(0, 1fr));
  }

  .maker {
    grid-area: 1 / 1;
  }

  .plus {
    grid-area: 1 / -2;
  }
}

@media (prefers-reduced-motion: reduce) {
  h1 {
    transform: none;
  }
}

@media (forced-colors: active) {
  .footer-lines {
    color: CanvasText;
    forced-color-adjust: none;
  }

  .maker img {
    padding: 2px;
    background: white;
    filter: none;
    forced-color-adjust: none;
  }

  .plus:not([data-glyph-cycle])::before,
  .plus:not([data-glyph-cycle])::after {
    background: CanvasText;
    forced-color-adjust: none;
  }

  .plus-glyph {
    color: CanvasText;
  }
}

.gradient-surface[hidden] {
  display: none;
}

.gradient-surface {
  position: absolute;
  pointer-events: none;
  inset: 0 var(--footer-depth) 0 auto;
  width: 20%;
  height: 100%;
}

@media (aspect-ratio < 1/1) {
  .gradient-surface {
    inset: auto 0 var(--footer-depth);
    width: 100%;
    height: 20%;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .product .backdrop[data-gradient-active]::after {
    background: none;
  }
}
