:root {
  color-scheme: light;
  --paper: #eeeade;
  --paper-deep: #e6e0d2;
  --graphite: #171817;
  --muted: #706e68;
  --line: rgba(60, 57, 50, .14);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
}

body {
  color: var(--graphite);
  font-family: Inter, system-ui, sans-serif;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.water-stage {
  position: relative;
  width: 100%;
  height: 100%;
  isolation: isolate;
  background:
    radial-gradient(circle at 48% 42%, rgba(255, 255, 255, .62), transparent 37%),
    linear-gradient(118deg, rgba(255, 255, 255, .22), transparent 48%),
    var(--paper);
}

.water-stage::after {
  position: absolute;
  z-index: 3;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: .2;
  mix-blend-mode: multiply;
  background-image:
    repeating-radial-gradient(circle at 20% 30%, transparent 0 2px, rgba(65, 53, 37, .045) 2.5px 3px),
    repeating-linear-gradient(96deg, rgba(255, 255, 255, .07) 0 1px, transparent 1px 5px);
  background-size: 9px 11px, 7px 13px;
}

#suminagashiCanvas {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.suminagashi-overlay {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.back-link {
  position: absolute;
  z-index: 7;
  top: 20px;
  right: 20px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 50%;
  background: rgba(18, 20, 19, .9);
  box-shadow: 0 7px 22px rgba(43, 40, 32, .14);
  transition: transform .25s ease, background .25s ease;
}

.back-link:hover,
.back-link:focus-visible {
  background: #080908;
  transform: rotate(7deg);
}

.back-link img {
  width: 17px;
  height: 17px;
  filter: grayscale(1) brightness(4);
}

.work-caption {
  position: absolute;
  z-index: 5;
  left: clamp(64px, 6vw, 108px);
  top: 43%;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(50, 48, 44, .55);
  font: 400 clamp(7px, .62vw, 10px)/1 Inter, sans-serif;
  letter-spacing: .32em;
  pointer-events: none;
  transform: rotate(90deg);
  transform-origin: left center;
  white-space: nowrap;
}

.work-caption i {
  width: 26px;
  height: 1px;
  background: currentColor;
  opacity: .45;
}

.word-announcement {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
}

.controls {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  display: flex;
  min-height: 50px;
  align-items: center;
  gap: 18px;
  padding: 8px 20px;
  border: 1px solid rgba(55, 53, 48, .18);
  border-radius: 999px;
  background: rgba(239, 236, 226, .76);
  box-shadow:
    0 18px 44px rgba(59, 53, 40, .12),
    inset 0 1px rgba(255, 255, 255, .72);
  backdrop-filter: blur(16px) saturate(.75);
  transform: translateX(-50%);
}

.ink-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ink-button {
  position: relative;
  display: grid;
  width: 30px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.ink-dot {
  display: block;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(0, 0, 0, .18);
  border-radius: 50%;
  box-shadow:
    inset 2px 2px 5px rgba(255, 255, 255, .35),
    0 1px 3px rgba(0, 0, 0, .16);
  transition: transform .2s ease, box-shadow .2s ease;
}

.ink-dot--zhu {
  background: conic-gradient(from 210deg, #9b1e1b, #d64938 34%, #dc6b52 55%, #2a4851 76%, #9b1e1b);
}

.ink-dot--sumi {
  background: radial-gradient(circle at 35% 28%, #4f5155, #24262b 47%, #111216 100%);
}

.ink-dot--blau {
  background: radial-gradient(circle at 35% 28%, #4b91d3, #286eb6 50%, #174982);
}

.ink-dot--matsuba {
  background: radial-gradient(circle at 35% 28%, #62a68d, #2c856c 52%, #1c6654);
}

.ink-button:hover .ink-dot,
.ink-button:focus-visible .ink-dot,
.ink-button.is-active .ink-dot {
  transform: translateY(-3px) scale(1.08);
  box-shadow:
    inset 2px 2px 5px rgba(255, 255, 255, .36),
    0 4px 9px rgba(0, 0, 0, .2);
}

.ink-button.is-active .ink-dot {
  outline: 1px solid rgba(29, 27, 24, .32);
  outline-offset: 3px;
}

.ink-name {
  position: absolute;
  bottom: calc(100% + 11px);
  left: 50%;
  padding: 2px 5px;
  color: #605d56;
  font: 300 9px/1 Inter, sans-serif;
  letter-spacing: .16em;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity .2s ease, transform .2s ease;
}

.ink-button:hover .ink-name,
.ink-button:focus-visible .ink-name,
.ink-button.is-active .ink-name {
  opacity: 1;
  transform: translate(-50%, 0);
}

.control-divider {
  width: 1px;
  height: 24px;
  background: var(--line);
}

.wash-button {
  padding: 7px 0;
  border: 0;
  background: transparent;
  color: #77736b;
  font: 300 10px/1 Inter, sans-serif;
  letter-spacing: .2em;
  white-space: nowrap;
  cursor: pointer;
  transition: color .2s ease;
}

.wash-button:hover,
.wash-button:focus-visible {
  color: #292824;
}

.inspiration-link {
  position: absolute;
  z-index: 7;
  left: 20px;
  bottom: max(20px, env(safe-area-inset-bottom));
  color: rgba(50, 48, 44, .46);
  font: 300 8px/1 Inter, sans-serif;
  letter-spacing: .16em;
  text-decoration: none;
  transition: color .2s ease;
}

.inspiration-link:hover,
.inspiration-link:focus-visible {
  color: rgba(29, 28, 25, .88);
}

.suminagashi-label {
  color: rgba(50, 48, 44, .55);
  font: 300 9px/1 Inter, sans-serif;
  letter-spacing: .32em;
}

.end-link {
  position: absolute;
  z-index: 7;
  right: 20px;
  bottom: max(20px, env(safe-area-inset-bottom));
  padding: 5px 10px;
  border: 1px solid rgba(60, 57, 50, .26);
  border-radius: 2px;
  text-decoration: none;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 1.4s ease, color .2s ease, border-color .2s ease;
}

.end-link.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.end-link:hover,
.end-link:focus-visible {
  color: rgba(29, 28, 25, .88);
  border-color: rgba(60, 57, 50, .48);
}

@media (max-width: 680px) {
  .back-link {
    top: 14px;
    right: 14px;
  }

  .work-caption {
    left: 48px;
  }

  .controls {
    max-width: calc(100% - 24px);
    gap: 11px;
    padding: 7px 13px;
  }

  .ink-controls {
    gap: 2px;
  }

  .control-divider {
    display: none;
  }

  .wash-button {
    font-size: 8px;
    letter-spacing: .13em;
  }

  .inspiration-link {
    left: 12px;
    bottom: max(9px, env(safe-area-inset-bottom));
    font-size: 7px;
  }

  .end-link {
    right: 12px;
    bottom: max(9px, env(safe-area-inset-bottom));
  }

  .suminagashi-label {
    font-size: 7px;
  }
}

@media (max-width: 430px) {
  .controls {
    min-height: 45px;
  }

  .ink-button {
    width: 27px;
  }

  .ink-dot {
    width: 19px;
    height: 19px;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
